AWS STS Role Assumption by User

Identifies when a user or role has assumed a role in AWS Security Token Service (STS). Users can assume a role to obtain temporary credentials and access AWS resources. Adversaries can use this technique for credential access and privilege escalation. This is a New Terms rule that identifies when a service assumes a role in AWS Security Token Service (STS) to obtain temporary credentials and access AWS resources. While often legitimate, adversaries may use this technique for unauthorized access, privilege escalation, or lateral movement within an AWS environment.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2024/11/05"
  3integration = ["aws"]
  4maturity = "production"
  5updated_date = "2025/06/18"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies when a user or role has assumed a role in AWS Security Token Service (STS). Users can assume a role to obtain temporary credentials and access AWS resources. Adversaries can use this technique for credential access and privilege escalation. This is a New Terms rule that identifies when a service assumes a role in AWS Security Token Service (STS) to obtain temporary credentials and access AWS resources. While often legitimate, adversaries may use this technique for unauthorized access, privilege escalation, or lateral movement within an AWS environment.
 11"""
 12false_positives = [
 13    "AWS administrators or automated processes might regularly assume roles for legitimate administrative purposes. Applications integrated with AWS might assume roles to access AWS resources. Automated workflows might assume roles to perform periodic tasks such as data backups, updates, or deployments.",
 14]
 15from = "now-6m"
 16interval = "5m"
 17index = ["filebeat-*", "logs-aws.cloudtrail-*"]
 18language = "kuery"
 19license = "Elastic License v2"
 20name = "AWS STS Role Assumption by User"
 21note = """## Triage and analysis
 22
 23### Investigating AWS STS Role Assumption by User
 24
 25This rule detects when a user assumes a role in AWS Security Token Service (STS), receiving temporary credentials to access AWS resources. While often used for legitimate purposes, this action can be leveraged by adversaries to obtain unauthorized access, escalate privileges, or move laterally within an AWS environment.
 26
 27#### Possible Investigation Steps
 28
 29- **Identify the User and Assumed Role**:
 30  - **User Identity**: Check `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.type` for details about the initiator of the `AssumeRole` action.
 31  - **Role Assumed**: Review `aws.cloudtrail.resources.arn` to confirm the role assumed and ensure it aligns with the user’s standard permissions.
 32  - **Session Name**: Note `aws.cloudtrail.flattened.request_parameters.roleSessionName` for context on the purpose of the session.
 33  - **Expiration Time**: Use `aws.cloudtrail.flattened.response_elements.credentials.expiration` to confirm the credential expiration.
 34
 35- **Inspect User Agent and Source Information**:
 36  - **User Agent**: Analyze the `user_agent.original` field to identify if specific tooling or SDKs like AWS CLI, Boto3, or custom agents were used.
 37  - **Source IP and Geolocation**: Examine `source.ip` and `source.geo` fields to determine the origin of the request, confirming if it aligns with expected locations.
 38
 39- **Correlate with Related Events**:
 40  - **Identify Patterns**: Review related CloudTrail events for unusual access patterns, such as resource access or sensitive actions following this `AssumeRole` action.
 41  - **Filter High-Volume Roles**: If this role or user has a high volume of access, evaluate `roleArn` or `user_agent` values for common patterns and add trusted entities as exceptions.
 42
 43- **Review the Privileges of the Assumed Role**:
 44  - **Permissions**: Examine permissions associated with the `roleArn` to assess its access scope.
 45  - **Authorized Usage**: Confirm if the role is used frequently for administrative purposes and if this aligns with the user’s regular responsibilities.
 46
 47### False Positive Analysis
 48
 49- **Automated Processes and Applications**: Applications or scheduled tasks may assume roles regularly for operational purposes. Validate the consistency of the `user_agent` or `roleArn` with known automated workflows.
 50- **Standard IAM Policy Usage**: Confirm if the user or application routinely assumes new roles for normal operations by reviewing historical activity.
 51
 52### Response and Remediation
 53
 54- **Terminate Unauthorized Sessions**: If the role assumption is deemed unauthorized, revoke the session by modifying IAM policies or the permissions associated with the assumed role.
 55- **Strengthen Monitoring and Alerts**: Implement additional monitoring for specific high-risk roles, especially those with elevated permissions.
 56- **Regularly Manage Exceptions**: Regularly review high-volume roles and user agent patterns to refine alerts, minimizing noise by adding trusted patterns as exceptions.
 57- **Incident Response**: If confirmed as malicious, follow incident response protocols for containment, investigation, and remediation.
 58
 59### Additional Information
 60
 61For more details on managing and securing AWS STS in your environment, refer to the [AWS STS documentation](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html).
 62"""
 63references = ["https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html"]
 64risk_score = 21
 65rule_id = "288a198e-9b9b-11ef-a0a8-f661ea17fbcd"
 66severity = "low"
 67tags = [
 68    "Domain: Cloud",
 69    "Data Source: AWS",
 70    "Data Source: Amazon Web Services",
 71    "Data Source: AWS STS",
 72    "Resources: Investigation Guide",
 73    "Use Case: Identity and Access Audit",
 74    "Tactic: Privilege Escalation",
 75    "Tactic: Lateral Movement",
 76]
 77timestamp_override = "event.ingested"
 78type = "new_terms"
 79
 80query = '''
 81event.dataset: "aws.cloudtrail"
 82    and event.provider: "sts.amazonaws.com"
 83    and event.action: "AssumeRole"
 84    and event.outcome: "success"
 85    and aws.cloudtrail.user_identity.type: ("AssumedRole" or "IAMUser")
 86'''
 87
 88[rule.investigation_fields]
 89field_names = [
 90    "@timestamp",
 91    "user.name",
 92    "user_agent.original",
 93    "source.ip",
 94    "aws.cloudtrail.user_identity.arn",
 95    "aws.cloudtrail.user_identity.type",
 96    "aws.cloudtrail.user_identity.access_key_id",
 97    "event.action",
 98    "event.outcome",
 99    "aws.cloudtrail.resources.arn",
100    "aws.cloudtrail.resources.type",
101    "aws.cloudtrail.flattened.request_parameters.roleSessionName",
102    "aws.cloudtrail.flattened.response_elements.credentials.accessKeyId",
103    "cloud.region",
104    "cloud.account.id",
105    "aws.cloudtrail.request_parameters",
106    "aws.cloudtrail.response_elements"
107]
108
109[[rule.threat]]
110framework = "MITRE ATT&CK"
111[[rule.threat.technique]]
112id = "T1548"
113name = "Abuse Elevation Control Mechanism"
114reference = "https://attack.mitre.org/techniques/T1548/"
115
116
117[rule.threat.tactic]
118id = "TA0004"
119name = "Privilege Escalation"
120reference = "https://attack.mitre.org/tactics/TA0004/"
121[[rule.threat]]
122framework = "MITRE ATT&CK"
123[[rule.threat.technique]]
124id = "T1550"
125name = "Use Alternate Authentication Material"
126reference = "https://attack.mitre.org/techniques/T1550/"
127[[rule.threat.technique.subtechnique]]
128id = "T1550.001"
129name = "Application Access Token"
130reference = "https://attack.mitre.org/techniques/T1550/001/"
131
132
133
134[rule.threat.tactic]
135id = "TA0008"
136name = "Lateral Movement"
137reference = "https://attack.mitre.org/tactics/TA0008/"
138
139[rule.new_terms]
140field = "new_terms_fields"
141value = ["cloud.account.id", "user.name", "aws.cloudtrail.resources.arn"]
142[[rule.new_terms.history_window_start]]
143field = "history_window_start"
144value = "now-10d"

Triage and analysis

Investigating AWS STS Role Assumption by User

This rule detects when a user assumes a role in AWS Security Token Service (STS), receiving temporary credentials to access AWS resources. While often used for legitimate purposes, this action can be leveraged by adversaries to obtain unauthorized access, escalate privileges, or move laterally within an AWS environment.

Possible Investigation Steps

  • Identify the User and Assumed Role:

    • User Identity: Check aws.cloudtrail.user_identity.arn and aws.cloudtrail.user_identity.type for details about the initiator of the AssumeRole action.
    • Role Assumed: Review aws.cloudtrail.resources.arn to confirm the role assumed and ensure it aligns with the user’s standard permissions.
    • Session Name: Note aws.cloudtrail.flattened.request_parameters.roleSessionName for context on the purpose of the session.
    • Expiration Time: Use aws.cloudtrail.flattened.response_elements.credentials.expiration to confirm the credential expiration.
  • Inspect User Agent and Source Information:

    • User Agent: Analyze the user_agent.original field to identify if specific tooling or SDKs like AWS CLI, Boto3, or custom agents were used.
    • Source IP and Geolocation: Examine source.ip and source.geo fields to determine the origin of the request, confirming if it aligns with expected locations.
  • Correlate with Related Events:

    • Identify Patterns: Review related CloudTrail events for unusual access patterns, such as resource access or sensitive actions following this AssumeRole action.
    • Filter High-Volume Roles: If this role or user has a high volume of access, evaluate roleArn or user_agent values for common patterns and add trusted entities as exceptions.
  • Review the Privileges of the Assumed Role:

    • Permissions: Examine permissions associated with the roleArn to assess its access scope.
    • Authorized Usage: Confirm if the role is used frequently for administrative purposes and if this aligns with the user’s regular responsibilities.

False Positive Analysis

  • Automated Processes and Applications: Applications or scheduled tasks may assume roles regularly for operational purposes. Validate the consistency of the user_agent or roleArn with known automated workflows.
  • Standard IAM Policy Usage: Confirm if the user or application routinely assumes new roles for normal operations by reviewing historical activity.

Response and Remediation

  • Terminate Unauthorized Sessions: If the role assumption is deemed unauthorized, revoke the session by modifying IAM policies or the permissions associated with the assumed role.
  • Strengthen Monitoring and Alerts: Implement additional monitoring for specific high-risk roles, especially those with elevated permissions.
  • Regularly Manage Exceptions: Regularly review high-volume roles and user agent patterns to refine alerts, minimizing noise by adding trusted patterns as exceptions.
  • Incident Response: If confirmed as malicious, follow incident response protocols for containment, investigation, and remediation.

Additional Information

For more details on managing and securing AWS STS in your environment, refer to the AWS STS documentation.

References

Related rules

to-top