Every shell leaves fingerprints. Understanding what defenders see is both a defensive exercise and an offensive one — if you know what gets flagged, you know what to change.
What Defenders Watch For
File Uploads & Webshells
Any new .php, .aspx, .jsp file in a web root is suspicious. File integrity monitoring (OSSEC, Wazuh, Tripwire) alerts on writes. Short files with eval, system, exec, passthru, assert, preg_replace /e, or base64_decode are classic webshell signatures.
Suspicious User Behavior
- Non-admin users running
whoami,net user,net group,systeminfo,ipconfig,tasklist - Users opening PowerShell with
-NoP -W Hidden -Exec Bypass - Service accounts spawning
cmd.exeorpowershell.exe - Office processes (
WINWORD.EXE,EXCEL.EXE) spawning shells
Network Anomalies
- Outbound connections to high random ports (4444, 1337, 9001) — classic reverse shell fingerprint
- “Heartbeat” patterns — small periodic beacons to the same IP
- Long-lived TCP sessions with low traffic
- Base64 blobs in HTTP traffic (encoded PowerShell payloads)
- DNS queries with unusually long subdomains (DNS tunneling)
Endpoint Telemetry
- Sysmon logs process creation with parent/child relationships — catches
w3wp.exe → cmd.exe → whoami - AMSI scans PowerShell and .NET content at runtime, even if obfuscated at source
- ETW (Event Tracing for Windows) sees PowerShell script block logging
- EDR (Defender ATP, CrowdStrike, SentinelOne) correlates process trees, memory scanning, and network IoCs
Common IOCs Your Shells Leave Behind
| Payload | Indicator |
|---|---|
nc.exe | Hash matches known netcat signature, filename itself is a red flag |
| Default msfvenom EXE | Static signature in .text section, flagged by every AV in seconds |
shikata_ga_nai encoded | Decoder stub has a known pattern — AV catches the decoder |
| PowerShell reverse shell | Net.Sockets.TCPClient, -NoP -W Hidden, base64 blob with specific length ranges |
| Meterpreter reverse_tcp | DLL reflectively loaded in memory — EDR hooks catch it |
Webshells with eval($_POST) | YARA / regex rules flag immediately |
| Default Tomcat WAR | msfvenom-generated WARs all share structure and class names |
Prevention (What Blue Team Should Do)
- Application allow-listing — AppLocker, WDAC, Software Restriction Policies. Blocks arbitrary
.exeexecution. - Constrained Language Mode — breaks most PowerShell offensive tooling.
- PowerShell script block logging + transcription — captures what ran, even if obfuscated.
- Egress filtering — only allow known business protocols out of the network; drop 4444/TCP.
- Least privilege — webapp service accounts shouldn’t need to spawn shells. Prevent it at the OS level.
- Patch management — closes the RCE that would have delivered the shell in the first place.
- Network segmentation / DMZ — compromised web server can’t reach internal systems.
- STIG / CIS hardening — reduces attack surface before an attacker arrives.
- File integrity monitoring on web roots — catches new webshells within minutes.
- IDS/IPS with DPI — flags plaintext payloads (Snort/Suricata have signatures for Meterpreter staging and common reverse shells).
Operator Awareness
If you’re on an engagement that includes active defenders (purple team, assumed-breach, real pen test on monitored infra), assume the following is logged:
- Every process you spawn (Sysmon event 1)
- Every network connection you open (Sysmon event 3, firewall logs)
- Every PowerShell command (script block logging)
- Every file you write (Sysmon event 11, FIM)
- Every DNS query (resolver logs)
- Every HTTP request through a proxy (web proxy logs with full URL + user-agent)
Choices that reduce signal:
| Loud | Quieter |
|---|---|
nc -lvnp 4444 plaintext | meterpreter/reverse_https on 443 |
whoami && id && uname -a | Read specific files instead of recon commands |
powershell.exe -enc ... | Living-off-the-land binaries (LOLBAS) |
Dropping nc.exe to C:\Users\Public | In-memory PowerShell (IEX(IWR...)) |
| Default msfvenom EXE | Custom loader, template injection with -x -k |
| Reverse shell to an EC2 IP | Redirector / domain fronting |
Defender Bypass Awareness
Microsoft Defender’s real-time protection eats:
- Any raw msfvenom payload
Invoke-Mimikatz,PowerSploit, Nishang scripts by name- Reflective DLL loaders with known signatures
- base64 PowerShell with reverse-shell keywords
What still gets through (as of writing — this is a moving target):
- AMSI bypasses before loading offensive tooling
- Code-signed binaries carrying unsigned DLLs (DLL sideloading)
- Rust/Nim/Go loaders not yet signatured
- Direct syscalls that skip user-mode hooks
- Custom encryption for second-stage payloads
AV evasion is not scope
On a scoped engagement, if the rules of engagement say “no AV evasion,” don’t — you’re not there to prove bypass, you’re there to prove the vulnerability exists. Disable the AV on the lab box, note the finding, and move on.
Report what you tripped
Whatever you did that lit up the SOC is a finding, not a failure. The client needs to know their alerting works (or doesn’t) — include detection observations in the report.
