Skip to content

Commit 09719dd

Browse files
Aegrahimays11w0rk3r
authored
[Rule Tuning] Potential Shell via Web Server (elastic#2585)
* tuned web shell logic, and converted to EQL * Removed old, created new rule to bypass "type" bug * Revert "Removed old, created new rule to bypass "type" bug" This reverts commit e994b62. * Revert "tuned web shell logic, and converted to EQL" This reverts commit 28bda94. * Deprecated old rule, added new * formatting fix * removed endgame index * Fixed changes captured as edited, not created * Update rules/linux/persistence_shell_activity_through_web_server.toml Co-authored-by: Isai <[email protected]> * fix conflict * added host.os.type==linux for unit testing * removed wildcards in process.args * Update rules/linux/persistence_shell_activity_via_web_server.toml Co-authored-by: Jonhnathan <[email protected]> * fixed conflict by changing file name and changes * Trying to resolve the GH conflict * attempt to fix GH conflict #2 * Update persistence_shell_activity_by_web_server.toml * Added endgame support * Added OSQuery to investigation guide * Update rules/linux/persistence_linux_shell_activity_via_web_server.toml Co-authored-by: Jonhnathan <[email protected]> * Update rules/linux/persistence_linux_shell_activity_via_web_server.toml Co-authored-by: Jonhnathan <[email protected]> * removed investigation guide to add in future PR --------- Co-authored-by: Isai <[email protected]> Co-authored-by: Jonhnathan <[email protected]>
1 parent c443aad commit 09719dd

File tree

2 files changed

+83
-2
lines changed

2 files changed

+83
-2
lines changed

rules/linux/persistence_shell_activity_by_web_server.toml renamed to rules/_deprecated/persistence_shell_activity_by_web_server.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[metadata]
22
creation_date = "2020/02/18"
3+
deprecation_date = "2023/03/04"
34
integration = ["endpoint"]
4-
maturity = "production"
5+
maturity = "deprecated"
56
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
67
min_stack_version = "8.3.0"
7-
updated_date = "2023/02/22"
8+
updated_date = "2023/03/04"
89

910
[rule]
1011
author = ["Elastic"]
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[metadata]
2+
creation_date = "2023/03/04"
3+
integration = ["endpoint"]
4+
maturity = "production"
5+
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6+
min_stack_version = "8.3.0"
7+
updated_date = "2023/04/03"
8+
9+
[rule]
10+
author = ["Elastic"]
11+
description = "Identifies suspicious commands executed via a web server, which may suggest a vulnerability and remote shell access."
12+
false_positives = [
13+
"""
14+
Network monitoring or management products may have a web server component that runs shell commands as part of normal
15+
behavior.
16+
""",
17+
]
18+
from = "now-9m"
19+
index = ["logs-endpoint.events.*", "endgame-*"]
20+
language = "eql"
21+
license = "Elastic License v2"
22+
name = "Potential Remote Code Execution via Web Server"
23+
references = [
24+
"https://pentestlab.blog/tag/web-shell/",
25+
"https://www.elastic.co/security-labs/elastic-response-to-the-the-spring4shell-vulnerability-cve-2022-22965",
26+
]
27+
risk_score = 73
28+
rule_id = "f16fca20-4d6c-43f9-aec1-20b6de3b0aeb"
29+
severity = "high"
30+
tags = ["Elastic", "Host", "Linux", "Threat Detection", "Persistence", "Initial Access", "Elastic Endgame"]
31+
timestamp_override = "event.ingested"
32+
type = "eql"
33+
34+
query = '''
35+
process where host.os.type == "linux" and event.type == "start" and
36+
event.action in ("exec", "exec_event") and process.parent.executable : (
37+
"/usr/sbin/nginx", "/usr/local/sbin/nginx",
38+
"/usr/sbin/apache", "/usr/local/sbin/apache",
39+
"/usr/sbin/apache2", "/usr/local/sbin/apache2",
40+
"/usr/sbin/php*", "/usr/local/sbin/php*",
41+
"/usr/sbin/lighttpd", "/usr/local/sbin/lighttpd",
42+
"/usr/sbin/hiawatha", "/usr/local/sbin/hiawatha",
43+
"/usr/local/bin/caddy",
44+
"/usr/local/lsws/bin/lswsctrl",
45+
"*/bin/catalina.sh"
46+
) and
47+
process.name : ("*sh", "python*", "perl", "php*", "tmux") and
48+
process.args : ("whoami", "id", "uname", "cat", "hostname", "ip", "curl", "wget", "pwd")
49+
'''
50+
51+
52+
[[rule.threat]]
53+
framework = "MITRE ATT&CK"
54+
[[rule.threat.technique]]
55+
id = "T1505"
56+
name = "Server Software Component"
57+
reference = "https://attack.mitre.org/techniques/T1505/"
58+
[[rule.threat.technique.subtechnique]]
59+
id = "T1505.003"
60+
name = "Web Shell"
61+
reference = "https://attack.mitre.org/techniques/T1505/003/"
62+
63+
64+
65+
[rule.threat.tactic]
66+
id = "TA0003"
67+
name = "Persistence"
68+
reference = "https://attack.mitre.org/tactics/TA0003/"
69+
[[rule.threat]]
70+
framework = "MITRE ATT&CK"
71+
[[rule.threat.technique]]
72+
id = "T1190"
73+
name = "Exploit Public-Facing Application"
74+
reference = "https://attack.mitre.org/techniques/T1190/"
75+
76+
77+
[rule.threat.tactic]
78+
id = "TA0001"
79+
name = "Initial Access"
80+
reference = "https://attack.mitre.org/tactics/TA0001/"

0 commit comments

Comments
 (0)