Skip to content

Commit 56767c6

Browse files
Merge branch 'main' into 4891-fr-dac-add-arbitrary-file-location-support-for-local-creation-date
2 parents 8eab808 + 0d04f98 commit 56767c6

File tree

2 files changed

+36
-29
lines changed

2 files changed

+36
-29
lines changed

rules/cross-platform/privilege_escalation_sudoers_file_mod.toml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/04/13"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/07/14"
66

77
[rule]
88
author = ["Elastic"]
@@ -12,7 +12,7 @@ advantage of these configurations to execute commands as other users or spawn pr
1212
"""
1313
from = "now-9m"
1414
index = ["auditbeat-*", "logs-endpoint.events.*"]
15-
language = "kuery"
15+
language = "eql"
1616
license = "Elastic License v2"
1717
name = "Sudoers File Modification"
1818
references = ["https://www.elastic.co/security-labs/primer-on-persistence-mechanisms"]
@@ -29,12 +29,13 @@ tags = [
2929
"Resources: Investigation Guide",
3030
]
3131
timestamp_override = "event.ingested"
32-
type = "new_terms"
33-
32+
type = "eql"
3433
query = '''
35-
event.category:file and event.type:change and file.path:(/etc/sudoers* or /private/etc/sudoers*) and
36-
not process.name:(dpkg or platform-python or puppet or yum or dnf) and
37-
not process.executable:(/opt/chef/embedded/bin/ruby or /opt/puppetlabs/puppet/bin/ruby or /usr/bin/dockerd)
34+
file where host.os.type in ("linux", "macos") and event.type in ("creation", "change") and
35+
file.path like ("/etc/sudoers*", "/private/etc/sudoers*") and not (
36+
process.name in ("dpkg", "platform-python", "puppet", "yum", "dnf") or
37+
process.executable in ("/opt/chef/embedded/bin/ruby", "/opt/puppetlabs/puppet/bin/ruby", "/usr/bin/dockerd")
38+
)
3839
'''
3940
note = """## Triage and analysis
4041
@@ -71,30 +72,20 @@ The sudoers file is crucial in Unix-like systems, defining user permissions for
7172
- Implement additional monitoring on the affected system and similar systems to detect any further attempts to modify the sudoers file or other privilege escalation activities.
7273
- Review and update security policies and configurations to prevent similar incidents, ensuring that only authorized processes can modify the sudoers file."""
7374

74-
7575
[[rule.threat]]
7676
framework = "MITRE ATT&CK"
77+
7778
[[rule.threat.technique]]
7879
id = "T1548"
7980
name = "Abuse Elevation Control Mechanism"
8081
reference = "https://attack.mitre.org/techniques/T1548/"
82+
8183
[[rule.threat.technique.subtechnique]]
8284
id = "T1548.003"
8385
name = "Sudo and Sudo Caching"
8486
reference = "https://attack.mitre.org/techniques/T1548/003/"
8587

86-
87-
8888
[rule.threat.tactic]
8989
id = "TA0004"
9090
name = "Privilege Escalation"
9191
reference = "https://attack.mitre.org/tactics/TA0004/"
92-
93-
[rule.new_terms]
94-
field = "new_terms_fields"
95-
value = ["host.id", "process.executable", "file.path"]
96-
[[rule.new_terms.history_window_start]]
97-
field = "history_window_start"
98-
value = "now-7d"
99-
100-

rules/integrations/aws/persistence_iam_api_calls_via_user_session_token.toml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
creation_date = "2025/04/16"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/04/16"
5+
updated_date = "2025/07/10"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
Detects use of sensitive AWS STS or IAM API operations using temporary credentials (session tokens starting with 'ASIA').
11-
This may indicate credential theft or abuse of elevated access via a stolen session. It is not common for legitimate users to perform sensitive IAM operations with temporary session tokens.
10+
Detects use of sensitive AWS IAM API operations using temporary credentials (session tokens starting with 'ASIA'). This may indicate credential theft or abuse of elevated access via a stolen session. It is not common for legitimate users to perform sensitive IAM operations with temporary session tokens.
1211
"""
1312
false_positives = [
1413
"""
1514
Some CI/CD pipelines or administrative users may use session tokens. Review user context, IP, and timing to validate.
1615
""",
1716
]
18-
from = "now-9m"
17+
from = "now-6m"
1918
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
2019
language = "kuery"
2120
license = "Elastic License v2"
@@ -29,15 +28,15 @@ This rule detects sensitive IAM API operations performed using temporary AWS cre
2928
3029
#### Possible investigation steps:
3130
32-
- Review aws.cloudtrail.user_identity.arn to determine which IAM user or assumed role initiated the request.
33-
- Check aws.cloudtrail.user_identity.access_key_id to confirm if the credential starts with 'ASIA', indicating a temporary session token.
34-
- Examine aws.cloudtrail.user_identity.session_context.mfa_authenticated to verify whether MFA was present during session creation.
35-
- Investigate source.ip to assess whether the request originated from a known network, office IP, or corporate VPN.
36-
- Look at user_agent.original to determine if the API call came from a known CLI version or unexpected tool (e.g., unknown SDK, custom script).
31+
- Review `aws.cloudtrail.user_identity.arn` to determine which IAM user or assumed role initiated the request.
32+
- Check `aws.cloudtrail.user_identity.access_key_id` to confirm if the credential starts with 'ASIA', indicating a temporary session token.
33+
- Examine `aws.cloudtrail.user_identity.session_context.mfa_authenticated` to verify whether MFA was present during session creation.
34+
- Investigate `source.ip` to assess whether the request originated from a known network, office IP, or corporate VPN.
35+
- Look at `user_agent.original` to determine if the API call came from a known CLI version or unexpected tool (e.g., unknown SDK, custom script).
3736
- Confirm whether a recent sts:GetSessionToken, sts:AssumeRole, or AWS SSO login event issued the temporary credential.
3837
- Correlate other events using the same access key ID to identify additional privileged actions, such as iam:CreateAccessKey, iam:PutUserPolicy, or iam:EnableMFADevice.
3938
- Analyze timing via @timestamp to determine if the action occurred during off-hours or deviates from normal user behavior.
40-
- Review the event.outcome to check if the API call was successful or failed, which may indicate unauthorized access attempts.
39+
- Review the `event.outcome` to check if the API call was successful or failed, which may indicate unauthorized access attempts.
4140
- Check for related events in the same session, such as iam:CreateUser, iam:AttachUserPolicy, or sts:GetCallerIdentity, to identify potential lateral movement or privilege escalation.
4241
4342
### False positive analysis:
@@ -77,10 +76,27 @@ type = "new_terms"
7776
query = '''
7877
event.dataset: aws.cloudtrail
7978
and event.provider: ("iam.amazonaws.com")
79+
and event.outcome: "success"
8080
and aws.cloudtrail.user_identity.type: "IAMUser"
8181
and aws.cloudtrail.user_identity.access_key_id: ASIA*
8282
'''
8383

84+
[rule.investigation_fields]
85+
field_names = [
86+
"@timestamp",
87+
"user.name",
88+
"user_agent.original",
89+
"source.ip",
90+
"aws.cloudtrail.user_identity.arn",
91+
"aws.cloudtrail.user_identity.type",
92+
"aws.cloudtrail.user_identity.access_key_id",
93+
"event.action",
94+
"event.outcome",
95+
"cloud.account.id",
96+
"cloud.region",
97+
"aws.cloudtrail.request_parameters"
98+
]
99+
84100
[[rule.threat]]
85101
framework = "MITRE ATT&CK"
86102

0 commit comments

Comments
 (0)