-
Notifications
You must be signed in to change notification settings - Fork 570
[New Rule] PE via Container Misconfiguration #2983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9f9bae8
[New Rule] PE via Container Misconfiguration
Aegrah 2f3a2d7
fixed boolean comparison unit test error
Aegrah a9e677e
Update privilege_escalation_container_util_misconfiguration.toml
Aegrah c82d528
Merge branch 'main' into new-rule-docker-privesc
DefSecSentinel 06b391d
Update rules/linux/privilege_escalation_container_util_misconfigurati…
Aegrah f368795
Merge branch 'main' into new-rule-docker-privesc
Aegrah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
rules/linux/privilege_escalation_container_util_misconfiguration.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[metadata] | ||
creation_date = "2023/07/31" | ||
integration = ["endpoint"] | ||
maturity = "production" | ||
min_stack_comments = "New fields added: required_fields, related_integrations, setup" | ||
min_stack_version = "8.3.0" | ||
updated_date = "2023/07/31" | ||
|
||
[rule] | ||
author = ["Elastic"] | ||
description = """ | ||
This rule monitors for the execution of processes that interact with Linux containers through an interactive shell | ||
without root permissions. Utilities such as runc and ctr are universal command-line utilities leveraged to interact | ||
with containers via root permissions. On systems where the access to these utilities are misconfigured, attackers might | ||
be able to create and run a container that mounts the root folder or spawn a privileged container vulnerable to a | ||
container escape attack, which might allow them to escalate privileges and gain further access onto the host file system. | ||
""" | ||
from = "now-9m" | ||
index = ["logs-endpoint.events.*"] | ||
language = "eql" | ||
license = "Elastic License v2" | ||
name = "Potential Privilege Escalation via Container Misconfiguration" | ||
setup = """This rule leverages `session` fields, which requires that the collection of session data is enabled for Linux operating systems. | ||
|
||
The following steps should be performed in order to enable session data event collection on a Linux system. | ||
``` | ||
Kibana --> | ||
Management --> | ||
Fleet --> | ||
Agent Policies --> | ||
Agent Policy with Elastic Defend installed --> | ||
Elastic Defend integration --> | ||
Enable the "Collect session data" box under "Event Collection" for "Linux" | ||
``` | ||
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. | ||
""" | ||
references = [ | ||
"https://book.hacktricks.xyz/linux-hardening/privilege-escalation/runc-privilege-escalation", | ||
"https://book.hacktricks.xyz/linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation" | ||
] | ||
risk_score = 47 | ||
rule_id = "afe6b0eb-dd9d-4922-b08a-1910124d524d" | ||
severity = "medium" | ||
tags = ["Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Privilege Escalation", "Domain: Container"] | ||
timestamp_override = "event.ingested" | ||
type = "eql" | ||
query = ''' | ||
process where host.os.type == "linux" and event.action == "exec" and event.type == "start" and ( | ||
(process.name == "runc" and process.args == "run") or | ||
(process.name == "ctr" and process.args == "run" and process.args in ("--privileged", "--mount")) | ||
) and not user.Ext.real.id == "0" and not group.Ext.real.id == "0" and | ||
process.interactive == true and process.parent.interactive == true | ||
''' | ||
|
||
[[rule.threat]] | ||
framework = "MITRE ATT&CK" | ||
|
||
[[rule.threat.technique]] | ||
id = "T1611" | ||
name = "Escape to Host" | ||
reference = "https://attack.mitre.org/techniques/T1611/" | ||
|
||
[rule.threat.tactic] | ||
id = "TA0004" | ||
name = "Privilege Escalation" | ||
reference = "https://attack.mitre.org/tactics/TA0004/" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these fields dependent on session data? If so, we may want to add it in
setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, totally forgot about that. Added a small setup guide to the rule!