-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new rule 'AWS STS AssumeRoot by Rare User and Member Account' (#4271)
- Loading branch information
1 parent
04e1fc1
commit 2d79494
Showing
1 changed file
with
170 additions
and
0 deletions.
There are no files selected for viewing
170 changes: 170 additions & 0 deletions
170
...egrations/aws/privilege_escalation_sts_assume_root_from_rare_user_and_member_account.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
[metadata] | ||
creation_date = "2024/11/24" | ||
integration = ["aws"] | ||
maturity = "production" | ||
updated_date = "2024/11/24" | ||
|
||
[rule] | ||
author = ["Elastic"] | ||
description = """ | ||
Identifies when the STS `AssumeRoot` action is performed by a rare user in AWS. The AssumeRoot action allows users to | ||
assume the root member account role, granting elevated but specific permissions based on the task policy specified. | ||
Adversaries whom may have compromised user credentials, such as access and secret keys, can use this technique to | ||
escalate privileges and gain unauthorized access to AWS resources. This is a [New | ||
Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that identifies | ||
when the STS `AssumeRoot` action is performed by a user that rarely assumes this role and specific member account. | ||
""" | ||
false_positives = [ | ||
"AWS administrators or automated processes might regularly assume root for legitimate administrative purposes.", | ||
"AWS services might assume root to access AWS resources as part of their standard operations.", | ||
"Automated workflows might assume root to perform periodic administrative tasks.", | ||
] | ||
from = "now-9m" | ||
index = ["filebeat-*", "logs-aws.cloudtrail-*"] | ||
language = "kuery" | ||
license = "Elastic License v2" | ||
name = "AWS STS AssumeRoot by Rare User and Member Account" | ||
note = """ | ||
## Triage and Analysis | ||
### Investigating AWS STS AssumeRoot by Rare User and Member Account | ||
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. | ||
#### Possible Investigation Steps | ||
- **Identify the Actor and Assumed Role**: | ||
- **User Identity**: Review the `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.type` fields to determine who initiated the `AssumeRoot` action. | ||
- **Account Context**: Check the `aws.cloudtrail.recipient_account_id` field for the account affected by the action. This is likely the management account. | ||
- **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. | ||
- **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. | ||
- **Analyze Request Parameters**: | ||
- **Session Details**: Check `aws.cloudtrail.flattened.request_parameters.durationSeconds` for session duration. | ||
- **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. | ||
- **Target Entity**: Inspect the `aws.cloudtrail.flattened.request_parameters.targetPrincipal` field for the entity being accessed. This is typically the member account. | ||
- **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. | ||
- **Examine Response Details**: | ||
- **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`. | ||
- **Inspect Source Details**: | ||
- **Source IP and Location**: Evaluate `source.address` and `source.geo` fields to confirm the request's origin. Unusual locations might indicate unauthorized activity. | ||
- **User Agent**: Analyze `user_agent.original` to determine the tool or application used (e.g., AWS CLI, SDK, or custom tooling). | ||
- **Correlate with Related Events**: | ||
- **Concurrent Events**: Look for surrounding CloudTrail events that indicate follow-up actions, such as access to sensitive resources or privilege escalation attempts. | ||
- **Historical Activity**: Review historical activity for the `aws.cloudtrail.user_identity.arn` to determine if this action is anomalous. | ||
- **Evaluate Privilege Escalation Risk**: | ||
- **Role Privileges**: Inspect the privileges granted by the assumed role or task policy (`aws.cloudtrail.flattened.request_parameters.taskPolicyArn`). | ||
- **Operational Context**: Confirm whether the action aligns with routine operations or is unusual. | ||
### False Positive Analysis | ||
- **Authorized Administrative Activity**: | ||
- Verify if the activity was initiated by an AWS administrator for legitimate purposes. | ||
- **Automated Workflows**: | ||
- Identify if the action was part of an automated process or workflow. | ||
### Response and Remediation | ||
1. **Revoke Unauthorized Credentials**: | ||
- If malicious activity is identified, immediately revoke the session tokens and access keys associated with the `AssumeRoot` action. | ||
- It may be worth removing the compromised access key from the affected user or service account. | ||
2. **Enhance Monitoring**: | ||
- Increase the monitoring frequency for sensitive roles and actions, especially `AssumeRoot`. | ||
3. **Review IAM Policies**: | ||
- Limit permissions for accounts or roles to assume root and enforce multi-factor authentication (MFA) where applicable. | ||
4. **Contain and Investigate**: | ||
- Isolate affected accounts or roles and follow incident response procedures to determine the scope and impact of the activity. | ||
### Additional Information | ||
For more information on AssumeRoot, refer to the [AWS STS documentation](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html). | ||
""" | ||
references = ["https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html"] | ||
risk_score = 21 | ||
rule_id = "962a71ae-aac9-11ef-9348-f661ea17fbce" | ||
severity = "low" | ||
tags = [ | ||
"Domain: Cloud", | ||
"Data Source: AWS", | ||
"Data Source: Amazon Web Services", | ||
"Data Source: AWS STS", | ||
"Resources: Investigation Guide", | ||
"Use Case: Identity and Access Audit", | ||
"Tactic: Privilege Escalation", | ||
] | ||
timestamp_override = "event.ingested" | ||
type = "new_terms" | ||
|
||
query = ''' | ||
event.dataset: "aws.cloudtrail" | ||
and event.provider: "sts.amazonaws.com" | ||
and event.action: "AssumeRoot" | ||
and event.outcome: "success" | ||
''' | ||
|
||
|
||
[[rule.threat]] | ||
framework = "MITRE ATT&CK" | ||
[[rule.threat.technique]] | ||
id = "T1548" | ||
name = "Abuse Elevation Control Mechanism" | ||
reference = "https://attack.mitre.org/techniques/T1548/" | ||
[[rule.threat.technique.subtechnique]] | ||
id = "T1548.005" | ||
name = "Temporary Elevated Cloud Access" | ||
reference = "https://attack.mitre.org/techniques/T1548/005/" | ||
|
||
|
||
|
||
[rule.threat.tactic] | ||
id = "TA0004" | ||
name = "Privilege Escalation" | ||
reference = "https://attack.mitre.org/tactics/TA0004/" | ||
[[rule.threat]] | ||
framework = "MITRE ATT&CK" | ||
[[rule.threat.technique]] | ||
id = "T1098" | ||
name = "Account Manipulation" | ||
reference = "https://attack.mitre.org/techniques/T1098/" | ||
[[rule.threat.technique.subtechnique]] | ||
id = "T1098.003" | ||
name = "Additional Cloud Roles" | ||
reference = "https://attack.mitre.org/techniques/T1098/003/" | ||
|
||
|
||
|
||
[rule.threat.tactic] | ||
id = "TA0003" | ||
name = "Persistence" | ||
reference = "https://attack.mitre.org/tactics/TA0003/" | ||
|
||
[rule.investigation_fields] | ||
field_names = [ | ||
"@timestamp", | ||
"aws.cloudtrail.user_identity.type", | ||
"aws.cloudtrail.user_identity.arn", | ||
"aws.cloudtrail.user_identity.access_key_id", | ||
"source.address", | ||
"aws.cloudtrail.resources.account_id", | ||
"aws.cloudtrail.recipient_account_id", | ||
"aws.cloudtrail.flattened.request_parameters", | ||
"event.action", | ||
"event.outcome", | ||
"aws.cloudtrail.flattened.request_parameters.taskPolicyArn", | ||
"cloud.region", | ||
"aws.cloudtrail.request_parameters", | ||
"aws.cloudtrail.response_elements", | ||
] | ||
|
||
[rule.new_terms] | ||
field = "new_terms_fields" | ||
value = ["aws.cloudtrail.user_identity.arn", "aws.cloudtrail.resources.account_id"] | ||
[[rule.new_terms.history_window_start]] | ||
field = "history_window_start" | ||
value = "now-10d" | ||
|
||
|