Unusual Process Spawned from Web Server Parent
This rule detects unusual processes spawned from a web server parent process by identifying low frequency counts of process spawning activity. Unusual process spawning activity may indicate an attacker attempting to establish persistence, execute malicious commands, or establish command and control channels on the host system. ES|QL rules have limited fields available in its alert documents. Make sure to review the original documents to aid in the investigation of this alert.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2025/03/04"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2025/03/20"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule detects unusual processes spawned from a web server parent process by identifying low frequency counts of
11process spawning activity. Unusual process spawning activity may indicate an attacker attempting to establish
12persistence, execute malicious commands, or establish command and control channels on the host system. ES|QL rules have
13limited fields available in its alert documents. Make sure to review the original documents to aid in the investigation
14of this alert.
15"""
16from = "now-61m"
17interval = "1h"
18language = "esql"
19license = "Elastic License v2"
20name = "Unusual Process Spawned from Web Server Parent"
21risk_score = 47
22rule_id = "976b2391-413f-4a94-acb4-7911f3803346"
23setup = """## Setup
24
25This rule requires data coming in from Elastic Defend.
26
27### Elastic Defend Integration Setup
28Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
29
30#### Prerequisite Requirements:
31- Fleet is required for Elastic Defend.
32- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
33
34#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
35- Go to the Kibana home page and click "Add integrations".
36- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
37- Click "Add Elastic Defend".
38- Configure the integration name and optionally add a description.
39- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
40- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
41- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
42- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
43For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
44- Click "Save and Continue".
45- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
46For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
47"""
48severity = "medium"
49tags = [
50 "Domain: Endpoint",
51 "OS: Linux",
52 "Use Case: Threat Detection",
53 "Tactic: Persistence",
54 "Tactic: Execution",
55 "Tactic: Command and Control",
56 "Data Source: Elastic Defend",
57]
58timestamp_override = "event.ingested"
59type = "esql"
60
61query = '''
62from logs-endpoint.events.process-*
63| keep @timestamp, host.os.type, event.type, event.action, process.parent.name, user.name, user.id, process.working_directory, process.name, process.executable, process.command_line, process.parent.executable, agent.id
64| where @timestamp > now() - 1 hours
65| where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
66 process.parent.name in (
67 "apache", "nginx", "apache2", "httpd", "lighttpd", "caddy", "node", "mongrel_rails", "java", "gunicorn",
68 "uwsgi", "openresty", "cherokee", "h2o", "resin", "puma", "unicorn", "traefik", "tornado", "hypercorn",
69 "daphne", "twistd", "yaws", "webfsd", "httpd.worker", "flask", "rails", "mongrel"
70 ) or
71 process.parent.name like "php-*" or
72 process.parent.name like "python*" or
73 process.parent.name like "ruby*" or
74 process.parent.name like "perl*" or
75 user.name in (
76 "apache", "www-data", "httpd", "nginx", "lighttpd", "tomcat", "tomcat8", "tomcat9", "ftp", "ftpuser", "ftpd"
77 ) or
78 user.id in ("99", "33", "498", "48") or
79 process.working_directory like "/var/www/*"
80) and
81not (
82 process.working_directory like "/home/*" or
83 process.working_directory like "/" or
84 process.parent.executable like "/vscode/vscode-server/*"
85)
86| stats cc = count(), agent_count = count_distinct(agent.id) by process.executable, process.working_directory, process.parent.executable
87| where agent_count == 1 and cc < 5
88| sort cc asc
89| limit 100
90'''
91
92
93[[rule.threat]]
94framework = "MITRE ATT&CK"
95[[rule.threat.technique]]
96id = "T1505"
97name = "Server Software Component"
98reference = "https://attack.mitre.org/techniques/T1505/"
99[[rule.threat.technique.subtechnique]]
100id = "T1505.003"
101name = "Web Shell"
102reference = "https://attack.mitre.org/techniques/T1505/003/"
103
104
105
106[rule.threat.tactic]
107id = "TA0003"
108name = "Persistence"
109reference = "https://attack.mitre.org/tactics/TA0003/"
110[[rule.threat]]
111framework = "MITRE ATT&CK"
112[[rule.threat.technique]]
113id = "T1059"
114name = "Command and Scripting Interpreter"
115reference = "https://attack.mitre.org/techniques/T1059/"
116[[rule.threat.technique.subtechnique]]
117id = "T1059.004"
118name = "Unix Shell"
119reference = "https://attack.mitre.org/techniques/T1059/004/"
120
121
122
123[rule.threat.tactic]
124id = "TA0002"
125name = "Execution"
126reference = "https://attack.mitre.org/tactics/TA0002/"
127[[rule.threat]]
128framework = "MITRE ATT&CK"
129[[rule.threat.technique]]
130id = "T1071"
131name = "Application Layer Protocol"
132reference = "https://attack.mitre.org/techniques/T1071/"
133
134
135[rule.threat.tactic]
136id = "TA0011"
137name = "Command and Control"
138reference = "https://attack.mitre.org/tactics/TA0011/"
Related rules
- Simple HTTP Web Server Creation
- Unusual Command Execution from Web Server Parent
- Uncommon Destination Port Connection by Web Server
- Simple HTTP Web Server Connection
- Dracut Module Creation