Spotting Web Shell Execution: Web Server Spawning Suspicious Child Processes
When adversaries exploit vulnerabilities in web applications (e.g., Log4j, ProxyLogon, file upload flaws), their initial post-exploitation step is dropping a web shell. Once loaded, the web server process (such as IIS w3wp.exe or Apache httpd.exe) spawns shell interpreters to run system enumeration commands.
In legitimate operations, web servers should virtually never spawn command interpreters.
Log Source
- Microsoft Defender for Endpoint:
DeviceProcessEvents
Web Shell KQL Detection Query
// Detect Web Servers Spawning Command Shells and System Reconnaissance Utilities
let timeRange = 7d;
let webServerProcesses = dynamic([
"w3wp.exe",
"httpd.exe",
"nginx.exe",
"tomcat.exe",
"php-cgi.exe",
"java.exe"
]);
let suspiciousChildren = dynamic([
"cmd.exe",
"powershell.exe",
"pwsh.exe",
"whoami.exe",
"net.exe",
"net1.exe",
"quser.exe",
"nltest.exe",
"certutil.exe",
"bitsadmin.exe"
]);
DeviceProcessEvents
| where TimeGenerated >= ago(timeRange)
| where InitiatingProcessFileName in~ (webServerProcesses)
| where FileName in~ (suspiciousChildren)
| project TimeGenerated, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, ProcessCommandLine, AccountName
| order by TimeGenerated desc
Immediate Validation Steps
- Inspect
ProcessCommandLinefor reconnaissance patterns such aswhoami /all,net user, or download attempts viacertutil -urlcache. - Check
InitiatingProcessCommandLineto locate the exact IIS Application Pool or virtual directory being abused. - Quarantine the endpoint and isolate the uploaded
.aspx,.php, or.jspweb shell file.
MITRE ATT&CK Mapping
- Tactic: Persistence (TA0003), Initial Access (TA0001), Execution (TA0002)
- Technique: Server Software Component: Web Shell (T1505.003)
Responses (0)
Join the technical conversation or share implementation thoughts.
What are your thoughts?
Sign in to join the technical discussion or share feedback.
There are currently no responses for this story. Be the first to respond.