Skip to content

Commit bc58fc7

Browse files
imays11tradebot-elastic
authored andcommitted
[Rule Tuning] First Time Seen AWS Secret Value Accessed in Secrets Manager (#4992)
This rule is evaluating the "new terms" against every individual role session, rather than against the Role itself. This is causing a massive volume of alerts - updated rule description and investigation guide - reduced execution window and interval - replaced new terms from `user.id` to combination of `cloud.account.id` and `user.name` to account for evaluation against Roles and in the event that separate AWS accounts under the same Org reuse IAM user names. This will only evaluate the Role instead of each individual role session, which should greatly improve performance. (cherry picked from commit bfb29ec)
1 parent 37fafae commit bc58fc7

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

rules/integrations/aws/credential_access_new_terms_secretsmanager_getsecretvalue.toml

Lines changed: 22 additions & 8 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/02/03"
5+
updated_date = "2025/08/18"
66

77
[rule]
88
author = ["Nick Jones", "Elastic"]
@@ -12,18 +12,17 @@ attempt to leverage the compromised service to access secrets in AWS Secrets Man
1212
a specific user identity has programmatically retrieved a secret value from Secrets Manager using the `GetSecretValue`
1313
or `BatchGetSecretValue` actions. This rule assumes that AWS services such as Lambda functions and EC2 instances are
1414
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 such as an EC2 instance, Lambda function, or other service would rely
16-
on the compromised service's IAM role to access the secrets in Secrets Manager.
15+
adversary with access to a compromised AWS service would rely on its' attached role to access the secrets in Secrets Manager.
1716
"""
1817
false_positives = [
1918
"""
2019
Verify whether the user identity, user agent, and/or hostname should be using GetSecretString API for the specified
2120
SecretId. If known behavior is causing false positives, it can be exempted from the rule.
2221
""",
2322
]
24-
from = "now-60m"
23+
from = "now-6m"
2524
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
26-
interval = "10m"
25+
interval = "5m"
2726
language = "kuery"
2827
license = "Elastic License v2"
2928
name = "First Time Seen AWS Secret Value Accessed in Secrets Manager"
@@ -33,7 +32,7 @@ note = """## Triage and analysis
3332
3433
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.
3534
36-
This rule looks for the retrieval of credentials using `GetSecretValue` action in Secrets Manager programmatically. 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 specific secret value from Secrets Manager within the last 15 days.
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.
3736
3837
#### Possible investigation steps
3938
@@ -53,7 +52,7 @@ This rule looks for the retrieval of credentials using `GetSecretValue` action i
5352
5453
### False positive analysis
5554
56-
- Review `user.id` values for expected ARNs. If this is an expected behavior, consider adding exceptions to the rule.
55+
- Review `actor.entity.id` and `target.entity.id` values for expected combinations of identity and secret value access. If this is an expected behavior, consider adding exceptions to the rule.
5756
- False positives may occur due to the intended usage of the service. Tuning is needed in order to have higher confidence. Consider adding exceptions — preferably with a combination of user agent and IP address conditions.
5857
5958
### Response and remediation
@@ -101,6 +100,21 @@ event.dataset:aws.cloudtrail and event.provider:secretsmanager.amazonaws.com and
101100
not user_agent.name: ("Chrome" or "Firefox" or "Safari" or "Edge" or "Brave" or "Opera")
102101
'''
103102

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+
]
104118

105119
[[rule.threat]]
106120
framework = "MITRE ATT&CK"
@@ -122,7 +136,7 @@ reference = "https://attack.mitre.org/tactics/TA0006/"
122136

123137
[rule.new_terms]
124138
field = "new_terms_fields"
125-
value = ["user.id"]
139+
value = ["cloud.account.id", "user.name"]
126140
[[rule.new_terms.history_window_start]]
127141
field = "history_window_start"
128142
value = "now-10d"

0 commit comments

Comments
 (0)