When AWS credentials are compromised, most incident response playbooks focus on the immediate impact: what did the attacker access? What did they exfiltrate? But the more dangerous question is where did they go next — and sts:AssumeRole is almost always the answer.
AssumeRole is a legitimate, widely-used AWS feature. It lets one identity temporarily act as another role, acquiring that role's permissions for a session. Engineers use it constantly — for cross-account access, for CI/CD pipelines, for least-privilege delegation. Attackers use it for lateral movement, privilege escalation, and persistence.
Why AssumeRole is the attacker's favorite pivot
Most IAM users and roles are granted sts:AssumeRole permissions as a matter of course. A developer role that needs to deploy to staging might be allowed to assume a deployment role in a staging account. A CI/CD runner might be allowed to assume roles in 5 different accounts. A shared services role might be trusted by dozens of accounts in an organization.
When an attacker compromises any of these identities, they don't stop at what that identity can directly access. They enumerate what roles it can assume — and then assume them.
The enumeration step is straightforward. The attacker calls iam:ListRoles (if permitted) or tries a brute-force of known role names with sts:AssumeRole. Role names follow predictable patterns: OrganizationAccountAccessRole, TerraformExecutionRole, AdminRole, DeploymentRole. In an org with consistent naming conventions, the attacker can map a significant portion of the trust graph in under a minute.
The cross-account chain
The real leverage comes from cross-account role chaining. Consider this sequence:
- Attacker compromises a developer's IAM credentials in the dev account
- Developer role has permission to assume
StagingDeployRolein the staging account StagingDeployRolewas grantedsts:AssumeRoleonOrganizationAccountAccessRolein the management account (for a legacy reason no one remembers)OrganizationAccountAccessRolehasAdministratorAccessin the management account
Three AssumeRole calls. Developer credentials → management account administrator. This chain exists in more organizations than anyone would like to admit, because role trust policies accumulate over years and rarely get audited.
What CloudTrail shows
Every AssumeRole call is logged in CloudTrail. The event includes:
userIdentity— who is calling AssumeRole (the source identity)requestParameters.roleArn— which role is being assumedrequestParameters.roleSessionName— the name given to the sessionresponseElements.credentials— the temporary credentials issued (expiry time)sourceIPAddress— where the call came from
What CloudTrail doesn't make easy: correlating a chain of AssumeRole calls across accounts. Each call appears in the CloudTrail of the account where the call was made, not the target account. To trace a cross-account role chain, you need CloudTrail enabled in every account and a way to correlate events across them using the session name and source identity.
Most teams have CloudTrail enabled. Very few have alerts on AssumeRole patterns. The logs exist; the signal processing doesn't.
The detection signals to watch
These CloudTrail patterns indicate AssumeRole abuse:
1. AssumeRole from an unusual source IP
A role that normally gets assumed from within a VPC or from a known CI/CD IP range suddenly being assumed from a residential IP or a cloud provider range (AWS, GCP, Azure) in an unexpected region.
2. Rapid sequential AssumeRole calls
Legitimate automation assumes specific roles on a schedule. A human or automated tool assuming 5+ different roles within 60 seconds is enumeration behavior.
3. Cross-account AssumeRole to the management or payer account
Any AssumeRole call targeting the management account from a non-management identity should be treated as high-priority. Legitimate access to the management account is rare and should come from known identities.
4. AssumeRole using a roleSessionName that doesn't match known patterns
CI/CD systems typically use predictable session names like GitHubActions-deploy-prod. Session names like tmux, test123, or random strings suggest interactive enumeration.
5. AssumeRole followed immediately by IAM enumeration
sts:AssumeRole followed by iam:ListRoles, iam:ListPolicies, or iam:GetAccountAuthorizationDetails within the new session is a red flag. Legitimate services know what roles they need; attackers explore.
Why the 24-hour alert window is too slow
AWS's native credential compromise detection (GuardDuty) operates on a baseline model that takes time to establish. For a newly compromised identity or an identity used infrequently, GuardDuty may not fire at all on the first AssumeRole chain — there's no established baseline to deviate from.
More critically, even when GuardDuty fires, the finding typically arrives hours after the event. In an AssumeRole attack, the temporary credentials issued by the first AssumeRole call expire in 1-12 hours. By the time an alert fires, the session may be over — but the attacker has already used those credentials to create persistence elsewhere (new IAM user, new access key on an existing user, Lambda backdoor with execution role).
The window for intervention is short. Detection needs to happen in minutes, not hours.
Hardening your trust policies
Prevention matters as much as detection. Several practices significantly reduce AssumeRole attack surface:
Audit your role trust policies quarterly. For every role with a trust policy, ask: does this make sense today? Legacy trust relationships accumulate and rarely get removed when the original use case disappears.
Use aws:PrincipalOrgID conditions. If a role should only be assumed from within your organization, enforce it with a condition: "StringEquals": {"aws:PrincipalOrgID": "o-xxxx"}. This prevents external account compromise from reaching internal roles even if credentials are leaked.
Require ExternalId for cross-account assumptions. For roles trusted by external identities (partners, vendors), require an ExternalId in the trust policy. The attacker needs to know the ExternalId, which they won't have from credentials alone.
Restrict sts:AssumeRole in SCPs. At the AWS Organizations level, Service Control Policies can prevent any identity from assuming roles in the management account except from specific, named identities. This closes the management account as a lateral movement target regardless of individual role trust policies.
The bottom line
AssumeRole attacks succeed because the capabilities are legitimate, widely granted, and poorly monitored. The CloudTrail signal exists for every single call — it just doesn't get acted on.
SpikeCatcher monitors CloudTrail across all accounts in your organization for exactly these patterns: unusual AssumeRole sources, rapid enumeration behavior, cross-account pivots to sensitive accounts, and session activity that follows known attacker playbooks. Alerts fire in under 15 minutes. 14-day free trial, 5-min setup, read-only IAM.
Related articles
How to audit AWS for signs of past compromise (after the Qubole breach)
A vendor's IAM credentials assumed customer roles for two weeks unnoticed. A step-by-step audit with commands: trusted roles, AssumeRole hunting, persistence.
The access key nobody retired: how to find and kill stale AWS keys
A vendor key, never retired, found in their environment. Audit commands to find unused AWS access keys, check what they did, and retire them safely.
Bought the wrong Savings Plan? You have a short window to return it
AWS lets you return a mistaken Savings Plan for a limited time. The exact rules, the calendar-month trap, and which plans cannot be returned.
Protect your AWS account — 14-day free trial
Real-time threat and cost anomaly detection. Detects credential theft, cryptomining, and runaway costs in under 15 minutes. 5-minute setup via CloudFormation.
No credit card. Cancel anytime.