How the attack works
A role's trust policy is a resource-based policy that names who may assume it. UpdateAssumeRolePolicy replaces that document. A principal allowed to call it on a privileged role can add its own identity, an external AWS account, or a wildcard principal, and then obtain the role's temporary credentials through sts:AssumeRole.
Attackers use this for privilege escalation inside the account and, more often, for persistence from outside: once an external account they own is trusted, they can return without any credential in the victim account. CloudTrail records the caller in userIdentity, the role in requestParameters.roleName and the new trust document in requestParameters.policyDocument; the following AssumeRole call appears in sts.amazonaws.com events. Attackers also skip the edit and create a new role whose trust policy already names their principal, and CreateRole carries that document in requestParameters.assumeRolePolicyDocument.
What an attacker needs
- Credentials for a principal allowed to call iam:UpdateAssumeRolePolicy on the target role.
- For an external principal to use the role, the trust policy must not be constrained by conditions it cannot meet (for example aws:PrincipalOrgID).
Impact
Temporary credentials for the role whenever the attacker wants them, with the role's permissions. For administrator or deployment roles this is full account control that survives the removal of the original foothold.
Detection rules
IAM Role Trust Policy Updated
Detects UpdateAssumeRolePolicy calls, which replace the trust policy of an IAM role. Review requestParameters.policyDocument for principals that were not trusted before, especially external accounts and wildcards. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: IAM Role Trust Policy Updated
id: 6505f05b-3a50-41cc-93bb-ee184068f141
status: experimental
description: >-
Detects UpdateAssumeRolePolicy calls, which replace the trust policy of an
IAM role. Review requestParameters.policyDocument for principals that were
not trusted before, especially external accounts and wildcards.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/IAM/latest/APIReference/API_UpdateAssumeRolePolicy.html
- https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-10
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: aws
service: cloudtrail
detection:
selection:
eventSource: iam.amazonaws.com
eventName: UpdateAssumeRolePolicy
condition: selection
falsepositives:
- Trust changes deployed by infrastructure-as-code pipelines or the identity team; allow-list those callers and alert on changes made by any other identity.
level: medium
False positives
- Trust changes deployed by infrastructure-as-code pipelines or the identity team; allow-list those callers and alert on changes made by any other identity.
IAM Role Created with a Wildcard Principal in Its Trust Policy
Detects CreateRole calls whose trust policy, logged as a JSON string in requestParameters.assumeRolePolicyDocument, names a wildcard principal ("Principal": "*" or "AWS": "*"). AWS documents that a wildcard principal with an Allow effect grants access to all principals, and warns against it for role trust policies in particular. The rule reads the document as text with a regular expression that allows for whitespace and for a list of principals that starts with the wildcard. It does not read the Condition element: a wildcard that is narrowed by a condition such as aws:PrincipalOrgID also matches. A new role that trusts a specific outside account is not matched, because that needs a list of your own accounts (see the detection logic on the page). It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: IAM Role Created with a Wildcard Principal in Its Trust Policy
id: 661f7c45-0a03-40aa-b7e6-17a7b0372d79
status: experimental
description: >-
Detects CreateRole calls whose trust policy, logged as a JSON string in
requestParameters.assumeRolePolicyDocument, names a wildcard principal
("Principal": "*" or "AWS": "*"). AWS documents that a wildcard principal
with an Allow effect grants access to all principals, and warns against it
for role trust policies in particular. The rule reads the document as text
with a regular expression that allows for whitespace and for a list of
principals that starts with the wildcard. It does not read the Condition
element: a wildcard that is narrowed by a condition such as
aws:PrincipalOrgID also matches. A new role that trusts a
specific outside account is not matched, because that needs a list of your
own accounts (see the detection logic on the page).
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-log-file-examples.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html
- https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateRole.html
- https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: aws
service: cloudtrail
detection:
selection_event:
eventSource: iam.amazonaws.com
eventName: CreateRole
selection_wildcard:
requestParameters.assumeRolePolicyDocument|re: '"(AWS|Principal)"\s*:\s*\[?\s*"\*"'
condition: selection_event and selection_wildcard
falsepositives:
- Roles whose wildcard principal is limited by a condition (for example aws:PrincipalOrgID or aws:PrincipalArn), created by platform teams or vendor templates. Read the Condition element of the document before closing the alert, and add the provisioning roles to a filter_* selection on userIdentity.arn if they do this routinely.
level: high
False positives
- Roles whose wildcard principal is limited by a condition (for example aws:PrincipalOrgID or aws:PrincipalArn), created by platform teams or vendor templates. Read the Condition element of the document before closing the alert, and add the provisioning roles to a filter_* selection on userIdentity.arn if they do this routinely.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
New or changed role trust names an account that is not yours
An attacker who wants to come back from outside puts an account they own into the trust policy of a new or an existing role. The event shows the whole trust document, but only a comparison with your own account list tells an outside account from one of yours.
- Collect
CreateRoleandUpdateAssumeRolePolicyevents fromiam.amazonaws.com.CreateRolecarries the trust document inrequestParameters.assumeRolePolicyDocument, and forUpdateAssumeRolePolicyit is the PolicyDocument parameter of the request. - Extract every 12-digit account ID from the principals of the document, from account principals as well as from role and user ARNs.
- Compare each ID with the accounts of your organization and the vendor accounts you have approved, and alert when an ID is on neither list.
EventsCreateRoleUpdateAssumeRolePolicy
LimitsIt needs a current list of your accounts and approved third parties, and a new vendor integration looks the same until it is added. Service principals and federated principals carry no account ID to compare. A wildcard principal names no account and is covered by a rule on this page.
Role assumed from an account outside your organization
Once an outside account is trusted, its use is an ordinary AssumeRole call that succeeds. In the account that owns the role, the record of a call from another account names the calling account, and that can be compared with the accounts you know.
- In the account that owns the role, collect
AssumeRoleevents fromsts.amazonaws.comwhoseuserIdentity.typeisAWSAccount. AWS shows this form for a call that comes from another account, with the account of the caller inuserIdentity.accountId. - Take the role from
requestParameters.roleArnand the source address fromsourceIPAddress. - Alert when
userIdentity.accountIdis not one of your accounts or approved vendor accounts, with priority on roles that hold administrator or IAM permissions.
EventsAssumeRole
LimitsVendors and partners that assume roles by design must be on the list, or they alert on every call. AWS does not log denied AWS STS requests for cross-account role assumptions in the target account, so failed attempts from outside are invisible there.
Trust policy set and the role assumed shortly after
A trust change made by an attacker is followed by its use. The principal that was just added assumes the role, often within minutes, and the pair of events is far rarer than either event alone.
- A trust document is set by a
CreateRoleor anUpdateAssumeRolePolicyevent fromiam.amazonaws.com.CreateRolenames the role inrequestParameters.roleName, and forUpdateAssumeRolePolicyit is the RoleName parameter of the request. - Within 60 minutes an
AssumeRoleevent fromsts.amazonaws.comnames the same role at the end ofrequestParameters.roleArn. - Raise the priority when the caller of
AssumeRoleis not the principal that set the trust, or when it comes from another account or from a source address that is new for the role.
EventsCreateRoleUpdateAssumeRolePolicyAssumeRole
LimitsDeployment pipelines create a role and use it at once, so the roles and callers of your pipelines have to be excluded. The 60 minutes are a starting point. An attacker who waits longer before the first use does not match.
Triage
- Read requestParameters.policyDocument and list every principal it trusts; flag accounts outside the organization, wildcards and principals added by this change.
- Look for AssumeRole calls on the same role (requestParameters.roleArn) shortly after, and note the caller account and source IP address.
- If not approved, restore the previous trust policy and revoke the role's active sessions.
Response
Once the attack is confirmed:
- Put the previous trust policy back, so that the added principal can no longer assume the role.
- Revoke the active sessions of the role. Credentials obtained through
AssumeRolebefore the trust was restored stay valid until they expire, and the revocation denies requests made with credentials issued before that moment. - Review what the sessions of the role did since the change, in particular sessions started from the added principal, and remove what they created.
- Contain the principal that called
UpdateAssumeRolePolicy, and check whether it changed the trust policy of other roles. - If an external account was trusted, search your accounts for other roles and resource policies that name the same account ID.
- Confirm in CloudTrail that no
AssumeRolecall by the removed principal succeeds any more.
Mitigation
- Restrict iam:UpdateAssumeRolePolicy to IAM administrators, and deny trust changes on sensitive roles with an SCP.
- Use IAM Access Analyzer to report roles that can be assumed from outside the account or organization, and require aws:PrincipalOrgID or explicit account IDs in trust policies.
- Remove wildcard principals from existing trust policies.
Frequently asked questions
Does restoring the trust policy cut off an attacker who has already assumed the role?
No. The restored policy stops new `AssumeRole` calls by the removed principal. Temporary credentials that were issued before the fix keep working for the duration of the session. Revoke the active sessions of the role, which makes AWS deny requests made with credentials issued before that time, and then review what those sessions did.
Will I see the AssumeRole call if it comes from another account?
A successful one, yes. AWS documents that the call is logged in the calling account and in the account where the role is. Denied AWS STS requests for cross-account role assumptions are not logged in the target account, so the absence of failed calls does not show that nobody tried.
Does the event show which principal was added to the trust policy?
It shows the complete new trust document in `requestParameters.policyDocument`, because `UpdateAssumeRolePolicy` replaces the document. It does not show the previous one. List every principal the new document trusts and compare it with the last approved version to find what this change added.
References
- MITRE ATT&CK T1098.003: Additional Cloud Roles
- IAM API Reference: UpdateAssumeRolePolicy
- Logging IAM and AWS STS API calls with AWS CloudTrail
- Revoke IAM role temporary security credentials
- CloudTrail log file examples (CreateRole record with the trust document)
- AWS JSON policy elements: Principal (wildcard principals in trust policies)