Skip to content

Commit 133a079

Browse files
authored
[Rule Tuning] AWS IAM Assume Role Policy Update (#4799)
* [Rule Tuning] AWS IAM Assume Role Policy Update - changed time window to have only 1 minute lookback - changed the new terms field to look at combination of cloud.account.id, user.name, and roleName. This is to account for the problem with using user_identity.arn for AssumedRoles. Roles are identities in AWS that are granted a set of permissions and can then be assumed by various users across many different sessions. Each of these sessions is designated a session name which is attached to the `user_identity.arn`. This means that each time a Role is assumed, there is a unique user_identity.arn created. This rule is meant to capture unique instances of the Role itself which is captured separate from the individual session names in the `user.name` field. `cloud.account.id` has been added to the new_terms fields to account for organizations with multiple AWS account ids, which may reuse certain user.names across accounts. This may improve performance especially in environments where there are many users assuming the same role and updating it's trust policy as a part of normal operations. * remove markdown from description
1 parent 74d1715 commit 133a079

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

rules/integrations/aws/privilege_escalation_iam_update_assume_role_policy.toml

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

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
Identifies AWS CloudTrail events where an IAM role's trust policy has been updated. The trust policy is a JSON document
11-
that defines which principals are allowed to assume the role. An attacker may attempt to modify this policy to gain the
12-
privileges of the role. This is a [New
13-
Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule, which means it
14-
will only trigger once for each unique value of the `aws.cloudtrail.user_identity.arn` and
15-
`aws.cloudtrail.flattened.request_parameters.roleName` fields that has not been seen making this API request within the
16-
last 14 days.
10+
Identifies AWS CloudTrail events where an IAM role's trust policy has been updated by an IAM user or Assumed Role identity. The trust policy is a JSON document that defines which principals are allowed to assume the role. An attacker may attempt to modify this policy to gain the privileges of the role. This is a New Terms rule, which means it will only trigger once for each unique combination of the "cloud.account.id", "user.name" and "aws.cloudtrail.flattened.request_parameters.roleName" fields, that have not been seen making this API request within the last 14 days.
1711
"""
1812
false_positives = [
1913
"""
20-
Verify whether the user identity, user agent, and/or hostname should be making changes in your environment. Policy
21-
updates from unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can
22-
be exempted from the rule.
14+
Verify whether the user identity should be making changes in your environment. Policy updates from unfamiliar users should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
2315
""",
2416
]
25-
from = "now-9m"
17+
from = "now-6m"
18+
interval = "5m"
2619
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
2720
language = "kuery"
2821
license = "Elastic License v2"
@@ -37,7 +30,8 @@ The role trust policy is a JSON document in which you define the principals you
3730
3831
#### Possible investigation steps
3932
40-
- Review the `aws.cloudtrail.user_identity.arn` field to determine the user identity that performed the action.
33+
- Review the `aws.cloudtrail.user_identity.arn` to determine the IAM User that performed the action.
34+
- If an AssumedRole identity type performed the action review the `aws.cloudtrail.user_identity.session_context.session_issuer.arn` field to determine which role was used.
4135
- Review the `aws.cloudtrail.flattened.request_parameters.roleName` field to confirm the role that was updated.
4236
- Within the `aws.cloudtrail.request_parameters` field, review the `policyDocument` to understand the changes made to the trust policy.
4337
- If `aws.cloudtrail.user_identity.access_key_id` is present, investigate the access key used to perform the action as it may be compromised.
@@ -95,13 +89,34 @@ event.dataset: "aws.cloudtrail"
9589
'''
9690

9791

92+
[rule.investigation_fields]
93+
field_names = [
94+
"@timestamp",
95+
"user.name",
96+
"user_agent.original",
97+
"source.ip",
98+
"aws.cloudtrail.user_identity.type",
99+
"aws.cloudtrail.user_identity.arn",
100+
"aws.cloudtrail.user_identity.session_context.session_issuer.arn",
101+
"aws.cloudtrail.user_identity.access_key_id",
102+
"target.entity.id",
103+
"event.action",
104+
"event.outcome",
105+
"cloud.account.id",
106+
"cloud.region",
107+
"aws.cloudtrail.request_parameters"
108+
]
109+
98110
[[rule.threat]]
99111
framework = "MITRE ATT&CK"
100112
[[rule.threat.technique]]
101113
id = "T1078"
102114
name = "Valid Accounts"
103115
reference = "https://attack.mitre.org/techniques/T1078/"
104-
116+
[[rule.threat.technique.subtechnique]]
117+
id = "T1078.004"
118+
name = "Cloud Accounts"
119+
reference = "https://attack.mitre.org/techniques/T1078/004/"
105120

106121
[rule.threat.tactic]
107122
id = "TA0004"
@@ -110,9 +125,8 @@ reference = "https://attack.mitre.org/tactics/TA0004/"
110125

111126
[rule.new_terms]
112127
field = "new_terms_fields"
113-
value = ["aws.cloudtrail.user_identity.arn", "aws.cloudtrail.flattened.request_parameters.roleName"]
128+
value = ["cloud.account.id", "user.name", "aws.cloudtrail.flattened.request_parameters.roleName"]
114129
[[rule.new_terms.history_window_start]]
115130
field = "history_window_start"
116131
value = "now-14d"
117132

118-

0 commit comments

Comments
 (0)