Detecting Web Shells

Web Indicators

Unusual HTTP Methods & Request Patterns

Request Methods to Watch

MethodNormal UsagePossible Abuse
GETRetrieve a resourceRecon or interact with web shell
POSTSubmit dataUpload or interact with shell
PUTUpload/replace fileUpload shell
DELETERemove fileCleanup
OPTIONSQuery supported methodsReconnaissance
HEADGET without bodyProbe for files

Suspicious User-Agents & IP Addresses

Query Strings

Missing Referrer

The referrer shows the URL the users visited before being linked to the current page.

A missing referrer can be potentially indicative of web shell activity. There are valid reasons why a referrer might be missing (e.g., browsers blocking them for privacy, if a URL is directly accessed).

Example of Suspicious Web Request

Common Web Shell Locations

Suspicious or Random File Names

Network Traffic Analysis

Useful Wireshark Filters

http.request.method == "METHOD"
http.request.uri contains ".php"
http.user_agent

Apache Log Investigation

cat /var/log/apache2/access.log | grep "404"
cat /var/log/apache2/access.log | grep "200"
cat /var/log/apache2/access.log | grep "POST"
cat /var/log/apache2/access.log | grep "curl"
cat /var/log/apache2/access.log | grep "cmd"