Detect Shared Webroot in CrowdStrike LogScale
Adversaries may add malicious content to an internally accessible website through an open network file share that contains the website's webroot or web content directory. By writing a malicious script (PHP, ASPX, JSP, etc.) to the shared webroot and then browsing to it, the adversary causes the web server process to execute the content — typically resulting in a webshell. This technique enables lateral movement to the system running the web server, as the code runs under the web server process context (IIS, Apache, nginx) which may have local system or administrative privileges. The attack chain: (1) discover open share pointing to webroot, (2) write malicious web script via SMB, (3) trigger execution via HTTP request. This technique has been deprecated by MITRE but the underlying behavior remains operationally relevant as a webshell deployment vector.
MITRE ATT&CK
- Tactic
- Lateral Movement
- Canonical reference
- https://attack.mitre.org/techniques/T1051/
LogScale Detection Query
(#event_simpleName = ProcessRollup2 OR #event_simpleName = SyntheticProcessRollup2 OR #event_simpleName = NewExecutableWritten)
| case {
#event_simpleName in (ProcessRollup2, SyntheticProcessRollup2)
AND ParentBaseFileName = /(?i)^(w3wp|httpd|httpd2|nginx|php-cgi|php-win|tomcat[0-9]?|java|iisexpress|UMWorkerProcess)\.exe$/
AND FileName = /(?i)^(cmd|powershell|pwsh|wscript|cscript|mshta|net|net1|whoami|ipconfig|systeminfo|nltest|certutil|bitsadmin|rundll32|regsvr32|msiexec)\.exe$/
| DetectionBranch := "WebShellChildProcess" ;
#event_simpleName = NewExecutableWritten
AND TargetFileName = /(?i)(\\inetpub\\wwwroot\\|\\xampp\\htdocs\\|\\wamp\\www\\|\\wamp64\\www\\|\\Apache24\\htdocs\\|\\nginx\\html\\|\\tomcat\\webapps\\|\\jetty\\webapps\\|\/var\/www\/html\/|\/srv\/www\/)/
AND TargetFileName = /(?i)\.(php5?|phtml|aspx?|ashx|asmx|jspx?|cfml?|pl|cgi|shtml)$/
NOT ParentBaseFileName = /(?i)^(w3wp|httpd|nginx|msiexec|TrustedInstaller)\.exe$/
| DetectionBranch := "WebRootFileDrop" ;
}
| groupBy(
[ComputerName, DetectionBranch, ParentBaseFileName, FileName, TargetFileName, UserName, CommandLine],
function=[
count(as=HitCount),
min(timestamp, as=FirstSeen),
max(timestamp, as=LastSeen)
]
)
| sort(LastSeen, order=desc) Two-branch CrowdStrike LogScale (Humio) detection for T1051 Shared Webroot. Branch 1 uses ProcessRollup2 and SyntheticProcessRollup2 Falcon events to detect web server processes (w3wp, httpd, nginx, java/Tomcat, iisexpress) spawning suspicious child utilities (cmd.exe, PowerShell, whoami, certutil, etc.) indicating active webshell execution. Branch 2 uses NewExecutableWritten events to detect web script files written to webroot directories by non-web-server processes, capturing the initial webshell drop phase. Results are grouped by host, branch, and process chain to suppress repeated execution noise while preserving all unique actor/command combinations. Requires CrowdStrike Falcon sensor with Process, File Write, and Script Control enabled. Adjust the event_simpleName filter if your environment uses custom enriched event names.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate application deployment processes using the web server service account to write updated application files — NewExecutableWritten events from msdeploy.exe or xcopy.exe targeting wwwroot are common in mature DevOps pipelines; add known deployment binary hashes to a reference lookup table and exclude
- Java-based application servers (Tomcat, JBoss, WebSphere) frequently spawn child java.exe processes for background jobs, JSP recompilation, and JMX operations — the ParentBaseFileName=java.exe → FileName=java.exe pattern is typically benign; focus alerting on java.exe spawning OS utilities
- Penetration testing and red team activity using authorized webshell frameworks (e.g., Antak, China Chopper simulation tools) during scheduled engagements will generate high-fidelity hits — correlate alert timestamps with active pen test windows from your change management system before escalating
Other platforms for T1051
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Drop PHP Webshell via SMB Network Share to Webroot
Expected signal: Windows Security Event ID 5140: Network share \\TARGET_WEBSERVER\wwwroot accessed from source workstation. Windows Security Event ID 4624: Network logon (Type 3) to TARGET_WEBSERVER using webadmin credentials. Sysmon Event ID 11 on TARGET_WEBSERVER: FileCreate for df00tech-test-shell.php in C:\inetpub\wwwroot\, InitiatingProcess will be System (SMB kernel write). DeviceFileEvents on TARGET_WEBSERVER: FileCreated for df00tech-test-shell.php with folder path containing wwwroot.
- Test 2Trigger Webshell Execution via HTTP GET Request
Expected signal: Sysmon Event ID 1 on TARGET_WEBSERVER: Process Create where ParentImage is php-cgi.exe (or w3wp.exe for ASPX), Image is cmd.exe or whoami.exe, CommandLine contains 'whoami'. DeviceProcessEvents: InitiatingProcessFileName=php-cgi.exe spawning FileName=cmd.exe. IIS access log entry for GET /df00tech-test-shell.php with query string cmd=whoami, HTTP 200 response.
- Test 3Drop ASPX Webshell to IIS Webroot via Local File Copy
Expected signal: Sysmon Event ID 11: FileCreate for df00tech-test-shell.aspx in C:\inetpub\wwwroot\, InitiatingProcess=cmd.exe. DeviceFileEvents: FileCreated, FileName=df00tech-test-shell.aspx, FolderPath=C:\inetpub\wwwroot\, InitiatingProcessFileName=cmd.exe. Security Event ID 4663 if object-level SACL auditing is configured on the wwwroot directory.
- Test 4Enumerate Accessible Webroot Network Shares
Expected signal: Windows Security Event ID 5140 on TARGET_WEBSERVER: Network share \\TARGET_WEBSERVER\wwwroot accessed. Windows Security Event ID 5156: Windows Filtering Platform allowed inbound connection on port 445. Sysmon Event ID 3 on attacker host: outbound network connection to TARGET_WEBSERVER:445. Windows Security Event ID 4624: Type 3 (Network) logon to TARGET_WEBSERVER.
- Test 5PHP File Drop Simulating CMS Plugin Install Gone Wrong
Expected signal: Sysmon Event ID 11: FileCreate for df00tech-update.php in C:\inetpub\wwwroot\uploads\, InitiatingProcess=powershell.exe. DeviceFileEvents: FileCreated, FileName=df00tech-update.php, FolderPath=C:\inetpub\wwwroot\uploads\, InitiatingProcessFileName=powershell.exe. PowerShell ScriptBlock Log Event ID 4104 with Set-Content command writing PHP content.
References (10)
- https://attack.mitre.org/techniques/T1051/
- https://www.webroot.com/blog/2011/02/22/malicious-php-scripts-on-the-rise/
- http://httpd.apache.org/docs/2.4/getting-started.html#content
- https://capec.mitre.org/data/definitions/563.html
- https://learn.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1505.003/T1505.003.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/file
- https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-5140
- https://www.sans.org/reading-room/whitepapers/webserv/detecting-web-shells-33156
- https://www.cisa.gov/news-events/alerts/2021/02/10/cisa-er21-02-01-remediating-microsoft-exchange-vulnerabilities
Unlock Pro Content
Get the full detection package for T1051 including response playbook, investigation guide, and atomic red team tests.