Skip to content

Commit 25545b5

Browse files
authored
[Rule Tunings] AWS New Terms History Window Reduction (#5479)
I reduced the history window for new terms rules that were either: - `now-14 days` - showing slow performance metrics There are still several AWS rules with a `now-10d` window but they are not showing any performance issues so I'd like to leave them as is for now. First Time Seen AWS Secret Value Accessed in Secrets Manager - removed `BatchGetSecretValue` API call since this calls `GetSecretValue` - removed the user_agent exclusions from this one, too easy to bypass. AWS EC2 User Data Retrieval for EC2 Instance - excluded more benign AWS services from telemetry AWS IAM Assume Role Policy Update - removed use of cloudformation exclusion, this should be captured as well
1 parent d1f9ebb commit 25545b5

11 files changed

+111
-94
lines changed

rules/integrations/aws/collection_s3_unauthenticated_bucket_access_by_rare_source.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/12/17"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/09/08"
5+
updated_date = "2025/12/16"
66

77
[rule]
88
author = ["Elastic"]
@@ -181,6 +181,6 @@ field = "new_terms_fields"
181181
value = ["source.address", "tls.client.server_name"]
182182
[[rule.new_terms.history_window_start]]
183183
field = "history_window_start"
184-
value = "now-7d"
184+
value = "now-5d"
185185

186186

rules/integrations/aws/credential_access_new_terms_secretsmanager_getsecretvalue.toml

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

77
[rule]
88
author = ["Nick Jones", "Elastic"]
99
description = """
1010
An adversary with access to a compromised AWS service such as an EC2 instance, Lambda function, or other service may
1111
attempt to leverage the compromised service to access secrets in AWS Secrets Manager. This rule looks for the first time
12-
a specific user identity has programmatically retrieved a secret value from Secrets Manager using the `GetSecretValue`
13-
or `BatchGetSecretValue` actions. This rule assumes that AWS services such as Lambda functions and EC2 instances are
14-
setup with IAM role's assigned that have the necessary permissions to access the secrets in Secrets Manager. An
15-
adversary with access to a compromised AWS service would rely on its' attached role to access the secrets in Secrets Manager.
12+
a specific user identity has programmatically retrieved a secret value from Secrets Manager using the GetSecretValue
13+
action. This rule assumes that AWS services such as Lambda functions and EC2 instances are setup with IAM role's
14+
assigned that have the necessary permissions to access the secrets in Secrets Manager. An adversary with access to a
15+
compromised AWS service would rely on its' attached role to access the secrets in Secrets Manager.
1616
"""
1717
false_positives = [
1818
"""
@@ -22,7 +22,6 @@ false_positives = [
2222
]
2323
from = "now-6m"
2424
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
25-
interval = "5m"
2625
language = "kuery"
2726
license = "Elastic License v2"
2827
name = "First Time Seen AWS Secret Value Accessed in Secrets Manager"
@@ -32,7 +31,7 @@ note = """## Triage and analysis
3231
3332
AWS Secrets Manager is a service that enables the replacement of hardcoded credentials in code, including passwords, with an API call to Secrets Manager to retrieve the secret programmatically.
3433
35-
This rule looks for the retrieval of credentials from Secrets Manager using `GetSecretValue` or `BatchGetSecretValue` API calls. This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule indicating this is the first time a specific user identity has successfuly retrieved a secret value from Secrets Manager.
34+
This rule looks for the retrieval of credentials from Secrets Manager using `GetSecretValue` API calls. This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule indicating this is the first time a specific user identity has successfuly retrieved a secret value from Secrets Manager.
3635
3736
#### Possible investigation steps
3837
@@ -95,26 +94,12 @@ timestamp_override = "event.ingested"
9594
type = "new_terms"
9695

9796
query = '''
98-
event.dataset:aws.cloudtrail and event.provider:secretsmanager.amazonaws.com and
99-
event.action: (GetSecretValue or BatchGetSecretValue) and event.outcome:success and
100-
not user_agent.name: ("Chrome" or "Firefox" or "Safari" or "Edge" or "Brave" or "Opera" or "Boto3")
97+
event.dataset: aws.cloudtrail
98+
and event.provider: secretsmanager.amazonaws.com
99+
and event.action: GetSecretValue
100+
and event.outcome: success
101101
'''
102102

103-
[rule.investigation_fields]
104-
field_names = [
105-
"@timestamp",
106-
"user.name",
107-
"user_agent.original",
108-
"source.ip",
109-
"aws.cloudtrail.user_identity.arn",
110-
"aws.cloudtrail.user_identity.type",
111-
"aws.cloudtrail.user_identity.access_key_id",
112-
"event.action",
113-
"event.outcome",
114-
"cloud.account.id",
115-
"cloud.region",
116-
"aws.cloudtrail.request_parameters"
117-
]
118103

119104
[[rule.threat]]
120105
framework = "MITRE ATT&CK"
@@ -134,11 +119,27 @@ id = "TA0006"
134119
name = "Credential Access"
135120
reference = "https://attack.mitre.org/tactics/TA0006/"
136121

122+
[rule.investigation_fields]
123+
field_names = [
124+
"@timestamp",
125+
"user.name",
126+
"user_agent.original",
127+
"source.ip",
128+
"aws.cloudtrail.user_identity.arn",
129+
"aws.cloudtrail.user_identity.type",
130+
"aws.cloudtrail.user_identity.access_key_id",
131+
"event.action",
132+
"event.outcome",
133+
"cloud.account.id",
134+
"cloud.region",
135+
"aws.cloudtrail.request_parameters",
136+
]
137+
137138
[rule.new_terms]
138139
field = "new_terms_fields"
139140
value = ["cloud.account.id", "user.name"]
140141
[[rule.new_terms.history_window_start]]
141142
field = "history_window_start"
142-
value = "now-10d"
143+
value = "now-5d"
143144

144145

rules/integrations/aws/credential_access_retrieve_secure_string_parameters_via_ssm.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -125,4 +125,4 @@ field = "new_terms_fields"
125125
value = ["cloud.account.id", "user.name"]
126126
[[rule.new_terms.history_window_start]]
127127
field = "history_window_start"
128-
value = "now-10d"
128+
value = "now-5d"

rules/integrations/aws/discovery_ec2_userdata_request_for_ec2_instance.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -13,7 +13,6 @@ gather sensitive data from the instance such as hardcoded credentials or to iden
1313
a New Terms rule that identifies the first time an IAM user or role requests the user data for a specific EC2 instance.
1414
"""
1515
from = "now-6m"
16-
interval = "5m"
1716
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
1817
language = "kuery"
1918
license = "Elastic License v2"
@@ -91,7 +90,10 @@ event.dataset: "aws.cloudtrail"
9190
and aws.cloudtrail.flattened.request_parameters.attribute: "userData"
9291
and not aws.cloudtrail.user_identity.invoked_by: (
9392
"AWS Internal" or
94-
"cloudformation.amazonaws.com"
93+
"cloudformation.amazonaws.com" or
94+
"aidevops.amazonaws.com" or
95+
"elasticmapreduce.amazonaws.com" or
96+
"aiops.amazonaws.com"
9597
)
9698
'''
9799

@@ -147,6 +149,6 @@ field = "new_terms_fields"
147149
value = ["cloud.account.id", "user.name", "aws.cloudtrail.flattened.request_parameters.instanceId"]
148150
[[rule.new_terms.history_window_start]]
149151
field = "history_window_start"
150-
value = "now-14d"
152+
value = "now-5d"
151153

152154

rules/integrations/aws/exfiltration_sns_rare_protocol_subscription_by_user.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/11/01"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/09/09"
5+
updated_date = "2025/12/16"
66

77
[rule]
88
author = ["Elastic"]
@@ -150,6 +150,6 @@ field = "new_terms_fields"
150150
value = ["cloud.account.id", "user.name", "aws.cloudtrail.flattened.request_parameters.protocol"]
151151
[[rule.new_terms.history_window_start]]
152152
field = "history_window_start"
153-
value = "now-14d"
153+
value = "now-7d"
154154

155155

rules/integrations/aws/impact_s3_unusual_object_encryption_with_sse_c.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -138,6 +138,6 @@ field = "new_terms_fields"
138138
value = ["cloud.account.id", "user.name", "tls.client.server_name"]
139139
[[rule.new_terms.history_window_start]]
140140
field = "history_window_start"
141-
value = "now-14d"
141+
value = "now-7d"
142142

143143

rules/integrations/aws/persistence_iam_api_calls_via_user_session_token.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -168,6 +168,6 @@ field = "new_terms_fields"
168168
value = ["aws.cloudtrail.user_identity.arn"]
169169
[[rule.new_terms.history_window_start]]
170170
field = "history_window_start"
171-
value = "now-14d"
171+
value = "now-7d"
172172

173173

rules/integrations/aws/privilege_escalation_iam_customer_managed_policy_attached_to_role.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -135,6 +135,6 @@ field = "new_terms_fields"
135135
value = ["cloud.account.id", "user.name", "target.entity.id"]
136136
[[rule.new_terms.history_window_start]]
137137
field = "history_window_start"
138-
value = "now-14d"
138+
value = "now-7d"
139139

140140

rules/integrations/aws/privilege_escalation_iam_update_assume_role_policy.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/07/06"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/10/17"
5+
updated_date = "2025/12/16"
66

77
[rule]
88
author = ["Elastic"]
@@ -21,7 +21,6 @@ false_positives = [
2121
]
2222
from = "now-6m"
2323
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
24-
interval = "5m"
2524
language = "kuery"
2625
license = "Elastic License v2"
2726
name = "AWS IAM Assume Role Policy Update"
@@ -90,7 +89,6 @@ event.dataset: "aws.cloudtrail"
9089
and event.provider: "iam.amazonaws.com"
9190
and event.action: "UpdateAssumeRolePolicy"
9291
and event.outcome: "success"
93-
and not source.address: "cloudformation.amazonaws.com"
9492
'''
9593

9694

@@ -134,6 +132,6 @@ field = "new_terms_fields"
134132
value = ["cloud.account.id", "user.name", "target.entity.id"]
135133
[[rule.new_terms.history_window_start]]
136134
field = "history_window_start"
137-
value = "now-14d"
135+
value = "now-7d"
138136

139137

rules/integrations/aws/privilege_escalation_role_assumption_by_service.toml

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@
22
creation_date = "2021/05/17"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/06/18"
5+
updated_date = "2025/12/16"
66

77
[rule]
88
author = ["Elastic", "Austin Songer"]
99
description = """
10-
Identifies when a service has assumed a role in AWS Security Token Service (STS). Services can assume a role to obtain temporary credentials and access AWS resources. Adversaries can use this technique for credential access and privilege escalation. This is a New Terms rule that identifies when a service assumes a role in AWS Security Token Service (STS) to obtain temporary credentials and access AWS resources. While often legitimate, adversaries may use this technique for unauthorized access, privilege escalation, or lateral movement within an AWS environment.
10+
Identifies when a service has assumed a role in AWS Security Token Service (STS). Services can assume a role to obtain
11+
temporary credentials and access AWS resources. Adversaries can use this technique for credential access and privilege
12+
escalation. This is a New Terms rule that identifies when a service assumes a role in AWS Security Token Service (STS)
13+
to obtain temporary credentials and access AWS resources. While often legitimate, adversaries may use this technique for
14+
unauthorized access, privilege escalation, or lateral movement within an AWS environment.
1115
"""
1216
false_positives = [
13-
"AWS administrators or automated processes might regularly assume roles for legitimate administrative purposes. AWS services might assume roles to access AWS resources as part of their standard operations. Automated workflows might assume roles to perform periodic tasks such as data backups, updates, or deployments.",
17+
"""
18+
AWS administrators or automated processes might regularly assume roles for legitimate administrative purposes. AWS
19+
services might assume roles to access AWS resources as part of their standard operations. Automated workflows might
20+
assume roles to perform periodic tasks such as data backups, updates, or deployments.
21+
""",
1422
]
1523
from = "now-6m"
16-
interval = "5m"
1724
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
1825
language = "kuery"
1926
license = "Elastic License v2"
@@ -99,24 +106,6 @@ event.dataset: "aws.cloudtrail"
99106
"autoscaling.amazonaws.com")
100107
'''
101108

102-
[rule.investigation_fields]
103-
field_names = [
104-
"@timestamp",
105-
"source.address",
106-
"user_agent.original",
107-
"aws.cloudtrail.user_identity.invoked_by",
108-
"aws.cloudtrail.user_identity.type",
109-
"aws.cloudtrail.flattened.response_elements.credentials.accessKeyId",
110-
"event.action",
111-
"event.outcome",
112-
"aws.cloudtrail.resources.arn",
113-
"aws.cloudtrail.resources.type",
114-
"aws.cloudtrail.flattened.request_parameters.roleSessionName",
115-
"cloud.region",
116-
"cloud.account.id",
117-
"aws.cloudtrail.request_parameters",
118-
"aws.cloudtrail.response_elements"
119-
]
120109

121110
[[rule.threat]]
122111
framework = "MITRE ATT&CK"
@@ -148,11 +137,30 @@ id = "TA0008"
148137
name = "Lateral Movement"
149138
reference = "https://attack.mitre.org/tactics/TA0008/"
150139

140+
[rule.investigation_fields]
141+
field_names = [
142+
"@timestamp",
143+
"source.address",
144+
"user_agent.original",
145+
"aws.cloudtrail.user_identity.invoked_by",
146+
"aws.cloudtrail.user_identity.type",
147+
"aws.cloudtrail.flattened.response_elements.credentials.accessKeyId",
148+
"event.action",
149+
"event.outcome",
150+
"aws.cloudtrail.resources.arn",
151+
"aws.cloudtrail.resources.type",
152+
"aws.cloudtrail.flattened.request_parameters.roleSessionName",
153+
"cloud.region",
154+
"cloud.account.id",
155+
"aws.cloudtrail.request_parameters",
156+
"aws.cloudtrail.response_elements",
157+
]
158+
151159
[rule.new_terms]
152160
field = "new_terms_fields"
153161
value = ["aws.cloudtrail.user_identity.invoked_by", "aws.cloudtrail.resources.arn"]
154162
[[rule.new_terms.history_window_start]]
155163
field = "history_window_start"
156-
value = "now-10d"
164+
value = "now-5d"
157165

158166

0 commit comments

Comments
 (0)