Skip to content

Commit e5bd20b

Browse files
Aegrahgithub-actions[bot]
authored andcommitted
[New Rule] PE via Container Misconfiguration (#2983)
* [New Rule] PE via Container Misconfiguration * fixed boolean comparison unit test error * Update privilege_escalation_container_util_misconfiguration.toml * Update rules/linux/privilege_escalation_container_util_misconfiguration.toml Co-authored-by: Justin Ibarra <[email protected]> --------- Co-authored-by: Colson Wilhoit <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit e904ebb)
1 parent b38d614 commit e5bd20b

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[metadata]
2+
creation_date = "2023/07/31"
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/07/31"
8+
9+
[rule]
10+
author = ["Elastic"]
11+
description = """
12+
This rule monitors for the execution of processes that interact with Linux containers through an interactive shell
13+
without root permissions. Utilities such as runc and ctr are universal command-line utilities leveraged to interact
14+
with containers via root permissions. On systems where the access to these utilities are misconfigured, attackers might
15+
be able to create and run a container that mounts the root folder or spawn a privileged container vulnerable to a
16+
container escape attack, which might allow them to escalate privileges and gain further access onto the host file system.
17+
"""
18+
from = "now-9m"
19+
index = ["logs-endpoint.events.*"]
20+
language = "eql"
21+
license = "Elastic License v2"
22+
name = "Potential Privilege Escalation via Container Misconfiguration"
23+
setup = """This rule leverages `session` fields, which requires that the collection of session data is enabled for Linux operating systems.
24+
25+
The following steps should be performed in order to enable session data event collection on a Linux system.
26+
```
27+
Kibana -->
28+
Management -->
29+
Fleet -->
30+
Agent Policies -->
31+
Agent Policy with Elastic Defend installed -->
32+
Elastic Defend integration -->
33+
Enable the "Collect session data" box under "Event Collection" for "Linux"
34+
```
35+
More information on this topic and how to enable session data collection can be found at https://www.elastic.co/blog/secure-your-cloud-with-cloud-workload-protection-in-elastic-security.
36+
"""
37+
references = [
38+
"https://book.hacktricks.xyz/linux-hardening/privilege-escalation/runc-privilege-escalation",
39+
"https://book.hacktricks.xyz/linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation"
40+
]
41+
risk_score = 47
42+
rule_id = "afe6b0eb-dd9d-4922-b08a-1910124d524d"
43+
severity = "medium"
44+
tags = ["Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Privilege Escalation", "Domain: Container"]
45+
timestamp_override = "event.ingested"
46+
type = "eql"
47+
query = '''
48+
process where host.os.type == "linux" and event.action == "exec" and event.type == "start" and (
49+
(process.name == "runc" and process.args == "run") or
50+
(process.name == "ctr" and process.args == "run" and process.args in ("--privileged", "--mount"))
51+
) and not user.Ext.real.id == "0" and not group.Ext.real.id == "0" and
52+
process.interactive == true and process.parent.interactive == true
53+
'''
54+
55+
[[rule.threat]]
56+
framework = "MITRE ATT&CK"
57+
58+
[[rule.threat.technique]]
59+
id = "T1611"
60+
name = "Escape to Host"
61+
reference = "https://attack.mitre.org/techniques/T1611/"
62+
63+
[rule.threat.tactic]
64+
id = "TA0004"
65+
name = "Privilege Escalation"
66+
reference = "https://attack.mitre.org/tactics/TA0004/"

0 commit comments

Comments
 (0)