|
2 | 2 | creation_date = "2024/11/24" |
3 | 3 | integration = ["aws"] |
4 | 4 | maturity = "production" |
5 | | -updated_date = "2025/01/10" |
| 5 | +updated_date = "2025/12/02" |
6 | 6 |
|
7 | 7 | [rule] |
8 | 8 | author = ["Elastic"] |
9 | 9 | description = """ |
10 | | -Identifies when the STS `AssumeRoot` action is performed by a rare user in AWS. The AssumeRoot action allows users to |
| 10 | +Identifies when the STS AssumeRoot action is performed by a rare user in AWS. The AssumeRoot action allows users to |
11 | 11 | assume the root member account role, granting elevated but specific permissions based on the task policy specified. |
12 | | -Adversaries whom may have compromised user credentials, such as access and secret keys, can use this technique to |
13 | | -escalate privileges and gain unauthorized access to AWS resources. This is a [New |
14 | | -Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that identifies |
15 | | -when the STS `AssumeRoot` action is performed by a user that rarely assumes this role and specific member account. |
| 12 | +Adversaries who have compromised user credentials can use this technique to |
| 13 | +escalate privileges and gain unauthorized access to AWS resources. This is a New Terms rule that identifies |
| 14 | +when the STS AssumeRoot action is performed by a user that rarely assumes this role against a specific member account. |
16 | 15 | """ |
17 | 16 | false_positives = [ |
18 | 17 | "AWS administrators or automated processes might regularly assume root for legitimate administrative purposes.", |
19 | 18 | "AWS services might assume root to access AWS resources as part of their standard operations.", |
20 | 19 | "Automated workflows might assume root to perform periodic administrative tasks.", |
21 | 20 | ] |
22 | | -from = "now-9m" |
| 21 | +from = "now-6m" |
23 | 22 | index = ["filebeat-*", "logs-aws.cloudtrail-*"] |
24 | 23 | language = "kuery" |
25 | 24 | license = "Elastic License v2" |
26 | 25 | name = "AWS STS AssumeRoot by Rare User and Member Account" |
27 | 26 | note = """ |
28 | 27 | ## Triage and analysis |
29 | 28 |
|
30 | | -### Investigating AWS STS AssumeRoot by Rare User and Member Account |
31 | | -
|
32 | | -This rule identifies instances where AWS STS (Security Token Service) is used to assume a root role, granting temporary credentials for AWS resource access. While this action is often legitimate, it can be exploited by adversaries to obtain unauthorized access, escalate privileges, or move laterally within an AWS environment. |
33 | | -
|
34 | | -#### Possible Investigation Steps |
35 | | -
|
36 | | -- **Identify the Actor and Assumed Role**: |
37 | | - - **User Identity**: Review the `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.type` fields to determine who initiated the `AssumeRoot` action. |
38 | | - - **Account Context**: Check the `aws.cloudtrail.recipient_account_id` field for the account affected by the action. This is likely the management account. |
39 | | - - **Authentication**: If available, review the `aws.cloudtrail.user_identity.access_key_id` to identify the access key used for the action. This key may be compromised in the case of unauthorized activity. |
40 | | - - **Resources**: Inspect `aws.cloudtrail.resources.type` and `aws.cloudtrail.resources.arn` to determine the resource or role assumed. This is the member account where the root role was assumed. |
41 | | -
|
42 | | -- **Analyze Request Parameters**: |
43 | | - - **Session Details**: Check `aws.cloudtrail.flattened.request_parameters.durationSeconds` for session duration. |
44 | | - - **Permissions**: Review `aws.cloudtrail.flattened.request_parameters.taskPolicyArn` for the associated policy. These policies are predefined and grant specific permissions to the assumed root account. |
45 | | - - **Target Entity**: Inspect the `aws.cloudtrail.flattened.request_parameters.targetPrincipal` field for the entity being accessed. This is typically the member account. |
46 | | - - **Target Policy**: Inspect the `aws.cloudtrail.flattened.request_parameters.targetPolicyArn` field for the policy applied to temporary root credentials. This can help determine the scope of the permissions granted. |
47 | | -
|
48 | | -- **Examine Response Details**: |
49 | | - - **Credentials Issued**: Review `aws.cloudtrail.flattened.response_elements.credentials` to confirm credentials were issued and note their expiration (`expiration` field). The temporary access key can be used to pivot into other actions done by the assumed root account by searching for the value in `aws.cloudtrail.user_identity.access_key_id`. |
50 | | -
|
51 | | -- **Inspect Source Details**: |
52 | | - - **Source IP and Location**: Evaluate `source.address` and `source.geo` fields to confirm the request's origin. Unusual locations might indicate unauthorized activity. |
53 | | - - **User Agent**: Analyze `user_agent.original` to determine the tool or application used (e.g., AWS CLI, SDK, or custom tooling). |
54 | | -
|
55 | | -- **Correlate with Related Events**: |
56 | | - - **Concurrent Events**: Look for surrounding CloudTrail events that indicate follow-up actions, such as access to sensitive resources or privilege escalation attempts. |
57 | | - - **Historical Activity**: Review historical activity for the `aws.cloudtrail.user_identity.arn` to determine if this action is anomalous. |
| 29 | +> **Disclaimer**: |
| 30 | +> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. |
| 31 | +> While every effort has been made to ensure its quality, validate and adapt it to suit your operational needs. |
58 | 32 |
|
59 | | -- **Evaluate Privilege Escalation Risk**: |
60 | | - - **Role Privileges**: Inspect the privileges granted by the assumed role or task policy (`aws.cloudtrail.flattened.request_parameters.taskPolicyArn`). |
61 | | - - **Operational Context**: Confirm whether the action aligns with routine operations or is unusual. |
62 | | -
|
63 | | -### False Positive Analysis |
64 | | -
|
65 | | -- **Authorized Administrative Activity**: |
66 | | - - Verify if the activity was initiated by an AWS administrator for legitimate purposes. |
67 | | -- **Automated Workflows**: |
68 | | - - Identify if the action was part of an automated process or workflow. |
69 | | -
|
70 | | -### Response and Remediation |
71 | | -
|
72 | | -1. **Revoke Unauthorized Credentials**: |
73 | | - - If malicious activity is identified, immediately revoke the session tokens and access keys associated with the `AssumeRoot` action. |
74 | | - - It may be worth removing the compromised access key from the affected user or service account. |
75 | | -2. **Enhance Monitoring**: |
76 | | - - Increase the monitoring frequency for sensitive roles and actions, especially `AssumeRoot`. |
77 | | -3. **Review IAM Policies**: |
78 | | - - Limit permissions for accounts or roles to assume root and enforce multi-factor authentication (MFA) where applicable. |
79 | | -4. **Contain and Investigate**: |
80 | | - - Isolate affected accounts or roles and follow incident response procedures to determine the scope and impact of the activity. |
81 | | -
|
82 | | -### Additional Information |
| 33 | +### Investigating AWS STS AssumeRoot by Rare User and Member Account |
83 | 34 |
|
84 | | -For more information on AssumeRoot, refer to the [AWS STS documentation](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html). |
| 35 | +AWS STS `AssumeRoot` issues temporary credentials that grant elevated access into a member account, constrained by the |
| 36 | +task policy and target policy attached to the request. In normal operations, only a small set of platform, security, or |
| 37 | +automation roles should ever need to perform `AssumeRoot`, and typically only against a predictable set of member |
| 38 | +accounts. |
| 39 | +
|
| 40 | +This rule is a New Terms rule that detects when a previously unseen combination of calling principal (`aws.cloudtrail.user_identity.arn`) and target member account (`aws.cloudtrail.resources.account_id`) successfully invokes `AssumeRoot`. Activity that matches this pattern may indicate privilege escalation, lateral movement into a new account, abuse of cross-account access paths, or misuse of administrative workflows. |
| 41 | +
|
| 42 | +#### Possible investigation steps |
| 43 | +
|
| 44 | +- **Identify the actor and target context** |
| 45 | + - Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id` to determine: |
| 46 | + - Whether the caller is an IAM user, federated user, or role. |
| 47 | + - Whether this identity is normally used for organization-level administration or automation. |
| 48 | + - Inspect `aws.cloudtrail.resources.account_id` and `aws.cloudtrail.recipient_account_id` to identify the affected member account. |
| 49 | + - Check `source.address`, `source.geo.*`, and `user_agent.original` to understand where and how the call was made (console, CLI, SDK, automation runner, VPN, corporate IP, etc.). |
| 50 | +
|
| 51 | +- **Understand session, policy, and target details** |
| 52 | + - Examine `aws.cloudtrail.request_parameters` for: |
| 53 | + - `taskPolicyArn` – which predefined task policy was requested and what category of operations it enables (e.g., investigation, remediation, read-only, or broad admin). |
| 54 | + - `targetPrincipal` and/or related target fields – which member account principal is being accessed. |
| 55 | + - Any duration or configuration parameters (such as `durationSeconds`) that indicate unusually long-lived sessions. |
| 56 | + - In `aws.cloudtrail.response_elements`, review: |
| 57 | + - `credentials.accessKeyId` and `credentials.expiration` to confirm that credentials were successfully issued and how long they are valid. |
| 58 | + - Any additional response fields that indicate session constraints or failures (if present). |
| 59 | +
|
| 60 | +- **Correlate follow-on activity from the assumed root session** |
| 61 | + - Use the temporary access key from `aws.cloudtrail.response_elements.credentials.accessKeyId` to pivot in CloudTrail: |
| 62 | + - Search for subsequent events where `aws.cloudtrail.user_identity.access_key_id` matches that key. |
| 63 | + - Look for high-impact actions such as: |
| 64 | + - IAM changes (`iam:CreateUser`, `iam:AttachRolePolicy`, `iam:PutRolePolicy`, `iam:UpdateAssumeRolePolicy`). |
| 65 | + - Guardrail changes (CloudTrail, Security Hub, Config, GuardDuty configuration or detector changes). |
| 66 | + - Data-impacting actions (S3 bucket policy changes, RDS/RDS snapshot operations, EFS/RDS delete, secrets reads). |
| 67 | + - Correlate with any prior events for the calling identity: |
| 68 | + - STS calls that created the session used to invoke `AssumeRoot` (e.g., `AssumeRole`, SSO/identity provider activity). |
| 69 | + - Recent IAM policy updates that broadened its ability to perform cross-account administration. |
| 70 | +
|
| 71 | +- **Assess timing and operational alignment** |
| 72 | + - Use `@timestamp`, `cloud.region`, and your change calendar to determine: |
| 73 | + - Whether the event occurred during a documented maintenance window or deployment. |
| 74 | + - Whether the region and account align with the caller’s normal operational scope. |
| 75 | + - Compare with other events in the same time window: |
| 76 | + - Organization-level changes, new account creation, or migration work. |
| 77 | + - Other sensitive operations from the same `source.ip` or principal. |
| 78 | +
|
| 79 | +- **Validate with owners** |
| 80 | + - Confirm with: |
| 81 | + - Cloud/infra platform teams that normally operate organization-level admin roles. |
| 82 | + - Security/IR teams if they were running an investigation workflow that legitimately uses `AssumeRoot`. |
| 83 | + - Check whether the use of `AssumeRoot` is documented in CI/CD or automation designs that might have just expanded to this account, explaining the New Terms trigger. |
| 84 | +
|
| 85 | +### False positive analysis |
| 86 | +
|
| 87 | +- **Legitimate administrative cross-account access** |
| 88 | + - Platform, security, or central operations teams may use `AssumeRoot` as part of sanctioned workflows for: |
| 89 | + - New account onboarding. |
| 90 | + - Centralized remediation or investigation. |
| 91 | + - Complex deployment or migration tasks. |
| 92 | + - If this is the first time a specific engineer or automation role is onboarded to a given member account, the rule will fire once because it is a New Terms rule. Validate and, if appropriate, document this as expected behavior. |
| 93 | +
|
| 94 | +- **Automation and scheduled workflows** |
| 95 | + - CI/CD pipelines, organization-wide maintenance jobs, or incident response automation may use `AssumeRoot`: |
| 96 | + - Identify automation roles and service principals that legitimately call `AssumeRoot`. |
| 97 | + - Tune with rule exceptions based on `aws.cloudtrail.user_identity.arn`, `user_agent.original`, or specific `taskPolicyArn` values used only by trusted workflows. |
| 98 | +
|
| 99 | +If a pattern emerges where specific roles regularly and legitimately assume root into a consistent set of accounts, consider documenting those identities and, if appropriate, creating narrow exceptions — while preserving coverage for new, unexpected combinations. |
| 100 | +
|
| 101 | +### Response and remediation |
| 102 | +
|
| 103 | +- **Contain potentially unauthorized sessions** |
| 104 | + - If the activity appears suspicious or unapproved: |
| 105 | + - Invalidate the credentials issued by `AssumeRoot` (where supported) or constrain their impact by immediately tightening IAM, SCPs, or network controls in the affected member account. |
| 106 | + - Rotate or revoke long-lived access keys associated with the calling principal. |
| 107 | + - Temporarily restrict permissions on roles allowed to call `AssumeRoot` until the investigation is complete. |
| 108 | +
|
| 109 | +- **Investigate scope and impact** |
| 110 | + - Using CloudTrail: |
| 111 | + - Enumerate all actions performed with the `AssumeRoot` session access key and identify: |
| 112 | + - Privilege changes (IAM users, roles, policies, permission boundaries, SCPs). |
| 113 | + - Changes to logging and security controls (CloudTrail, GuardDuty, Security Hub, Config, firewall/WAF rules). |
| 114 | + - Data-impacting operations on high-value services (S3, RDS, DynamoDB, Secrets Manager, KMS). |
| 115 | + - Check if similar `AssumeRoot` activity has occurred recently from the same `source.ip`, principal, or member account. |
| 116 | + - Engage application, data, and platform owners for the impacted account(s) to: |
| 117 | + - Assess potential data exposure, integrity issues, or downtime. |
| 118 | + - Determine whether any actions conflict with intended change plans. |
| 119 | +
|
| 120 | +- **Hardening and preventive controls** |
| 121 | + - Restrict and monitor `AssumeRoot` usage: |
| 122 | + - Limit which IAM roles and identities can call `sts:AssumeRoot`, using IAM conditions (e.g., `aws:PrincipalArn`, `aws:PrincipalOrgID`, `aws:RequestedRegion`). |
| 123 | + - Where possible, require strong authentication on the initiating principal (MFA, federated SSO, device posture). |
| 124 | + - Add guardrails and observability: |
| 125 | + - Use AWS Config, Security Hub, and/or AWS Organizations SCPs to: |
| 126 | + - Detect or constrain highly privileged cross-account actions. |
| 127 | + - Ensure logging and monitoring services cannot be disabled or modified by assumed sessions without additional friction. |
| 128 | + - Ensure `AssumeRoot` activity is included in your SIEM dashboards and investigation playbooks. |
| 129 | +
|
| 130 | +- **Post-incident improvements** |
| 131 | + - If activity is confirmed malicious or unsafe: |
| 132 | + - Rotate credentials for all involved principals and review recent STS session usage for anomalies. |
| 133 | + - Update internal runbooks to clearly define when `AssumeRoot` is allowed, who can perform it, and how it should be documented. |
| 134 | + - Refine this rule’s exceptions or tagging strategy so that legitimate, recurring workflows are well-understood, while preserving high-fidelity visibility into new or unexpected `AssumeRoot` behavior. |
| 135 | +
|
| 136 | +### Additional information |
| 137 | +
|
| 138 | +- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)** |
| 139 | +- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)** |
| 140 | +- **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/). |
85 | 141 | """ |
86 | 142 | references = ["https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html"] |
87 | | -risk_score = 21 |
| 143 | +risk_score = 47 |
88 | 144 | rule_id = "962a71ae-aac9-11ef-9348-f661ea17fbce" |
89 | | -severity = "low" |
| 145 | +severity = "medium" |
90 | 146 | tags = [ |
91 | 147 | "Domain: Cloud", |
92 | 148 | "Data Source: AWS", |
@@ -145,26 +201,27 @@ reference = "https://attack.mitre.org/tactics/TA0003/" |
145 | 201 | [rule.investigation_fields] |
146 | 202 | field_names = [ |
147 | 203 | "@timestamp", |
148 | | - "aws.cloudtrail.user_identity.type", |
| 204 | + "user.name", |
| 205 | + "user_agent.original", |
| 206 | + "source.ip", |
149 | 207 | "aws.cloudtrail.user_identity.arn", |
| 208 | + "aws.cloudtrail.user_identity.type", |
150 | 209 | "aws.cloudtrail.user_identity.access_key_id", |
151 | | - "source.address", |
152 | 210 | "aws.cloudtrail.resources.account_id", |
153 | | - "aws.cloudtrail.recipient_account_id", |
154 | | - "aws.cloudtrail.flattened.request_parameters", |
| 211 | + "aws.cloudtrail.resources.type", |
155 | 212 | "event.action", |
156 | 213 | "event.outcome", |
157 | | - "aws.cloudtrail.flattened.request_parameters.taskPolicyArn", |
| 214 | + "cloud.account.id", |
158 | 215 | "cloud.region", |
159 | 216 | "aws.cloudtrail.request_parameters", |
160 | | - "aws.cloudtrail.response_elements", |
| 217 | + "aws.cloudtrail.response_elements" |
161 | 218 | ] |
162 | 219 |
|
163 | 220 | [rule.new_terms] |
164 | 221 | field = "new_terms_fields" |
165 | 222 | value = ["aws.cloudtrail.user_identity.arn", "aws.cloudtrail.resources.account_id"] |
166 | 223 | [[rule.new_terms.history_window_start]] |
167 | 224 | field = "history_window_start" |
168 | | -value = "now-10d" |
| 225 | +value = "now-7d" |
169 | 226 |
|
170 | 227 |
|
0 commit comments