AWS IAM Brute Force of Assume Role Policy
Identifies a high number of failed attempts to assume an AWS Identity and Access Management (IAM) role. IAM roles are used to delegate access to users or services. An adversary may attempt to enumerate IAM roles in order to determine if a role exists before attempting to assume or hijack the discovered role.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/07/16"
3integration = ["aws"]
4maturity = "production"
5updated_date = "2024/05/21"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies a high number of failed attempts to assume an AWS Identity and Access Management (IAM) role. IAM roles are
11used to delegate access to users or services. An adversary may attempt to enumerate IAM roles in order to determine if a
12role exists before attempting to assume or hijack the discovered role.
13"""
14from = "now-20m"
15index = ["filebeat-*", "logs-aws.cloudtrail-*"]
16language = "kuery"
17license = "Elastic License v2"
18name = "AWS IAM Brute Force of Assume Role Policy"
19note = """## Triage and analysis
20
21### Investigating AWS IAM Brute Force of Assume Role Policy
22
23An IAM role is an IAM identity that you can create in your account that has specific permissions. An IAM role is similar to an IAM user, in that it is an AWS identity with permission policies that determine what the identity can and cannot do in AWS. However, instead of being uniquely associated with one person, a role is intended to be assumable by anyone who needs it. Also, a role does not have standard long-term credentials such as a password or access keys associated with it. Instead, when you assume a role, it provides you with temporary security credentials for your role session.
24
25Attackers may attempt to enumerate IAM roles in order to determine if a role exists before attempting to assume or hijack the discovered role.
26
27#### Possible investigation steps
28
29- Identify the user account that performed the action and whether it should perform this kind of action.
30- Verify if the `RoleName` parameter contains a unique value in all requests or if the activity is potentially a brute force attack.
31- Verify if the user account successfully updated a trust policy in the last 24 hours.
32- Examine whether this role existed in the environment by looking for past occurrences in your logs.
33- Investigate other alerts associated with the user account during the past 48 hours.
34- Contact the account and resource owners and confirm whether they are aware of this activity.
35- Consider the time of day. If the user is a human (not a program or script), did the activity take place during a normal time of day?
36- Examine the account's commands, API calls, and data management actions in the last 24 hours.
37- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.
38
39### False positive analysis
40
41- Verify the roles targeted in the failed attempts, and whether the subject role previously existed in the environment. If only one role was targeted in the requests and that role previously existed, it may be a false positive, since automations can continue targeting roles that existed in the environment in the past and cause false positives (FPs).
42
43### Response and remediation
44
45- Initiate the incident response process based on the outcome of the triage.
46- Disable or limit the account during the investigation and response.
47- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
48 - Identify the account role in the cloud environment.
49 - Assess the criticality of affected services and servers.
50 - Work with your IT team to identify and minimize the impact on users.
51 - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
52 - Identify any regulatory or legal ramifications related to this activity.
53- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
54- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
55- Consider enabling multi-factor authentication for users.
56- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
57- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
58- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
59- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
60
61## Setup
62
63The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
64references = [
65 "https://www.praetorian.com/blog/aws-iam-assume-role-vulnerabilities",
66 "https://rhinosecuritylabs.com/aws/assume-worst-aws-assume-role-enumeration/",
67]
68risk_score = 47
69rule_id = "ea248a02-bc47-4043-8e94-2885b19b2636"
70severity = "medium"
71tags = [
72 "Domain: Cloud",
73 "Data Source: AWS",
74 "Data Source: Amazon Web Services",
75 "Use Case: Identity and Access Audit",
76 "Resources: Investigation Guide",
77 "Tactic: Credential Access",
78]
79timestamp_override = "event.ingested"
80type = "threshold"
81
82query = '''
83event.dataset:aws.cloudtrail and
84 event.provider:iam.amazonaws.com and event.action:UpdateAssumeRolePolicy and
85 aws.cloudtrail.error_code:MalformedPolicyDocumentException and event.outcome:failure
86'''
87
88
89[[rule.threat]]
90framework = "MITRE ATT&CK"
91[[rule.threat.technique]]
92id = "T1110"
93name = "Brute Force"
94reference = "https://attack.mitre.org/techniques/T1110/"
95
96
97[rule.threat.tactic]
98id = "TA0006"
99name = "Credential Access"
100reference = "https://attack.mitre.org/tactics/TA0006/"
101
102[rule.threshold]
103field = []
104value = 25
Triage and analysis
Investigating AWS IAM Brute Force of Assume Role Policy
An IAM role is an IAM identity that you can create in your account that has specific permissions. An IAM role is similar to an IAM user, in that it is an AWS identity with permission policies that determine what the identity can and cannot do in AWS. However, instead of being uniquely associated with one person, a role is intended to be assumable by anyone who needs it. Also, a role does not have standard long-term credentials such as a password or access keys associated with it. Instead, when you assume a role, it provides you with temporary security credentials for your role session.
Attackers may attempt to enumerate IAM roles in order to determine if a role exists before attempting to assume or hijack the discovered role.
Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Verify if the
RoleName
parameter contains a unique value in all requests or if the activity is potentially a brute force attack. - Verify if the user account successfully updated a trust policy in the last 24 hours.
- Examine whether this role existed in the environment by looking for past occurrences in your logs.
- Investigate other alerts associated with the user account during the past 48 hours.
- Contact the account and resource owners and confirm whether they are aware of this activity.
- Consider the time of day. If the user is a human (not a program or script), did the activity take place during a normal time of day?
- Examine the account's commands, API calls, and data management actions in the last 24 hours.
- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.
False positive analysis
- Verify the roles targeted in the failed attempts, and whether the subject role previously existed in the environment. If only one role was targeted in the requests and that role previously existed, it may be a false positive, since automations can continue targeting roles that existed in the environment in the past and cause false positives (FPs).
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Assess the criticality of affected services and servers.
- Work with your IT team to identify and minimize the impact on users.
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
- Identify any regulatory or legal ramifications related to this activity.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
- Consider enabling multi-factor authentication for users.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices outlined by AWS.
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
Setup
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
References
Related rules
- AWS EC2 Admin Credential Fetch via Assumed Role
- AWS IAM User Addition to Group
- AWS IAM Assume Role Policy Update
- AWS Management Console Brute Force of Root User Identity
- AWS Management Console Root Login