Add PowerShell implementation of LegacyHive exploit - #5
Open
SleepTheGod wants to merge 2 commits into
Open
Conversation
This script implements the Windows User Profile Service Zero-Day (LegacyHive) in PowerShell, allowing for user profile manipulation using embedded C# for Native API access. Usage # Run as Administrator .\LegacyHive.ps1 <username> <password> <target_username> # Example .\LegacyHive.ps1 attacker P@ssw0rd victim Important Notes Requires Administrator privileges - The exploit needs to create object directories and symbolic links The target user must exist - The username provided as third parameter must be a valid local user The helper account (first two parameters) must have valid credentials and be able to logon interactively This is a POC - Use only in authorized testing environments The PowerShell version uses embedded C# to access the necessary Windows APIs and offreg.dll functionality Limitations vs Original C++ Thread context manipulation - The original code uses RaiseExceptionInThread to modify thread context; this is not implemented in PowerShell as it's extremely dangerous and rarely needed offreg.dll availability - The offline registry APIs are available on Windows 10/11; if missing, the exploit won't work Performance - PowerShell adds overhead compared to native C++ Security Warning This is a zero-day exploit for a Windows privilege escalation vulnerability. Use only for: Security research in controlled environments Authorized penetration testing Educational purposes Running this on production systems without authorization may be illegal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This script implements the Windows User Profile Service Zero-Day (LegacyHive) in PowerShell, allowing for user profile manipulation using embedded C# for Native API access.
Usage
Run as Administrator
.\LegacyHive.ps1 <target_username>
Example
.\LegacyHive.ps1 attacker P@ssw0rd victim
Important Notes
Requires Administrator privileges - The exploit needs to create object directories and symbolic links
The target user must exist - The username provided as third parameter must be a valid local user
The helper account (first two parameters) must have valid credentials and be able to logon interactively
This is a POC - Use only in authorized testing environments
The PowerShell version uses embedded C# to access the necessary Windows APIs and offreg.dll functionality
Limitations vs Original C++
Thread context manipulation - The original code uses RaiseExceptionInThread to modify thread context; this is not implemented in PowerShell as it's extremely dangerous and rarely needed
offreg.dll availability - The offline registry APIs are available on Windows 10/11; if missing, the exploit won't work
Performance - PowerShell adds overhead compared to native C++
Security Warning
This is a zero-day exploit for a Windows privilege escalation vulnerability. Use only for:
Security research in controlled environments
Authorized penetration testing
Educational purposes
Running this on production systems without authorization may be illegal.