Theory · 8 min · Web attack monitoring
Web shells
Find a web shell from the process tree and the file system.
A web shell is a script placed on a web server that runs commands sent over HTTP (T1505.003). It often follows an exploited upload form or vulnerability (T1190).
The strongest signal is on the endpoint: the web server process (w3wp.exe for IIS, httpd, apache2, nginx, php-fpm) starting cmd.exe, powershell.exe, sh or whoami.
On disk: a new .aspx, .php or .jsp file in an upload or web directory, with a timestamp that matches the first suspicious requests. In the access log: POSTs to that one file from few IPs.
NSA and ASD advise comparing the web root to a known-good version and alerting on web processes that spawn shells, because web shell traffic itself is easy to disguise.
Your turn: decide on a scenario. Which observation is the strongest sign of a web shell on an IIS server?
Do the interactive check Free, in the browser.
Sources
- Detect and prevent web shell malware (NSA and ASD) NSA
- ATT&CK T1505.003: Server Software Component: Web Shell MITRE ATT&CK v20