Skip to content

Commit fe06843

Browse files
authored
[New Rule] Unusual Process Spawned from Web Server Parent (#4513)
1 parent 6eed757 commit fe06843

File tree

1 file changed

+140
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)