Query Details
# Rule: Linux Webshell Indicators
## Description
Detects potential webshell activity by monitoring process events where suspicious processes associated with web servers and common system administration tools are executed.
- Source: [Sigma rule for Linux webshell detection](https://github.com/SigmaHQ/sigma/blob/0bb6f0c0d75ae3e1c37f9ab77d68f20cdb32ecd3/rules/linux/process_creation/proc_creation_lnx_webshell_detection.yml)
## Detection Logic
- Filters events to include process executions where:
- Initiating process filenames include common web server executables (`httpd`, `lighttpd`, `nginx`, `apache2`, `node`, `caddy`).
- Executed file names include common system administration tools (`whoami`, `ifconfig`, `ip`, `uname`, `cat`, `crontab`, `hostname`, `iptables`, `netstat`, `pwd`, `route`).
- Excludes events where:
- The initiating process filename is `calico-node`.
- The process command line includes `cat /proc/cpuinfo`.
## Tags
- Webshell Detection
- Process Events
- Linux
## Search Query
```kql
DeviceProcessEvents
| where InitiatingProcessFileName has_any ("httpd", "lighttpd", "nginx", "apache2", "node", "caddy")
| where FileName has_any ("whoami", "ifconfig", "ip", "uname", "cat", "crontab", "hostname", "iptables", "netstat", "pwd", "route")
| where InitiatingProcessFileName !contains "calico-node"
| where ProcessCommandLine !contains "cat /proc/cpuinfo"
This query is designed to detect potential webshell activity on Linux systems by monitoring specific process events. Here's a simplified summary:
Purpose: The query aims to identify suspicious activities that might indicate the presence of a webshell, a malicious script used to control a web server.
How It Works:
httpd, nginx, apache2, etc.whoami, ifconfig, uname, etc.Exclusions:
calico-node.cat /proc/cpuinfo.Tags: The query is tagged for webshell detection, process events, and Linux, indicating its focus areas.
DeviceProcessEvents
| where InitiatingProcessFileName has_any ("httpd", "lighttpd", "nginx", "apache2", "node", "caddy")
| where FileName has_any ("whoami", "ifconfig", "ip", "uname", "cat", "crontab", "hostname", "iptables", "netstat", "pwd", "route")
| where InitiatingProcessFileName !contains "calico-node"
| where ProcessCommandLine !contains "cat /proc/cpuinfo"
calico-node.cat /proc/cpuinfo.In essence, this query helps in identifying unusual activities that could suggest a webshell is being used to control the web server by executing system commands.

Ali Hussein
Released: July 8, 2024
Tables
Keywords
Operators