How the attack works
Amazon Cognito has two parts that matter here. An identity pool exchanges an identity, which can be a signed-in user of some provider or an unauthenticated guest, for temporary AWS credentials. Which IAM role those credentials belong to is set with SetIdentityPoolRoles: AWS describes the call as setting the roles that are used when GetCredentialsForIdentity is called, with one map of roles and optional role mappings per identity provider. Whether guests are accepted at all is the AllowUnauthenticatedIdentities setting of CreateIdentityPool and UpdateIdentityPool. A user pool is the directory that signs application users in, and SetUserPoolMfaConfig sets its multi-factor authentication to on, off or optional.
An attacker who has reached an account can turn each of these into a durable way back. Guest access on an identity pool, or a more privileged role behind it, lets anyone who knows the pool ID obtain AWS credentials without holding any IAM user, access key or role session of the account. MFA switched off for a user pool turns stolen or guessed passwords of application users into working sign-ins, and if the pool feeds an identity pool, into AWS credentials as well. None of this appears in reviews of IAM users and access keys.
Cognito logs these configuration calls as CloudTrail management events: all user pool actions under cognito-idp.amazonaws.com, and the identity pool operations other than the credential calls under cognito-identity.amazonaws.com. AWS's example record for CreateIdentityPool shows requestParameters.allowUnauthenticatedIdentities. The calls that hand out credentials (GetId, GetCredentialsForIdentity, GetOpenIdToken) are data events, which a trail does not log by default, so the use of a weakened pool is usually invisible. No incident report was used for this page: it follows what AWS documents about these settings.
What an attacker needs
- Credentials for a principal allowed cognito-identity:SetIdentityPoolRoles, cognito-identity:UpdateIdentityPool or cognito-identity:CreateIdentityPool, or cognito-idp:SetUserPoolMfaConfig on the user pool.
- For a more privileged role behind an identity pool, a role whose trust policy accepts Cognito identities of that pool.
- To make use of the change, the ID of the identity pool, or the password of a user in the user pool.
Impact
Temporary AWS credentials for the role behind the identity pool, for anyone who knows the pool ID when guest access is on, and for as long as the configuration stays. The damage is what that role may do. For a user pool without MFA, sign-in as application users with a password alone, with whatever access the application and a connected identity pool give them.
Detection rules
Cognito Identity Pool Created or Updated with Guest Access
Detects CreateIdentityPool and UpdateIdentityPool calls to Amazon Cognito identity pools whose request allows unauthenticated identities. With that setting the pool gives temporary AWS credentials for its unauthenticated role to callers who have not signed in anywhere, so anyone who knows the pool ID can obtain them. AWS's example record for CreateIdentityPool shows the setting in requestParameters.allowUnauthenticatedIdentities, and the UpdateIdentityPool API takes the same parameter. AWS documents for UpdateIdentityPool that a parameter without a value is set to its default, so callers send the whole configuration: an update of a pool that already allowed guests matches too. Check whether guest access is new, and what the unauthenticated role of the pool can do. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: Cognito Identity Pool Created or Updated with Guest Access
id: 7076b097-b25a-4fe2-8436-10e64042c3f3
status: experimental
description: >-
Detects CreateIdentityPool and UpdateIdentityPool calls to Amazon Cognito
identity pools whose request allows unauthenticated identities. With that
setting the pool gives temporary AWS credentials for its unauthenticated
role to callers who have not signed in anywhere, so anyone who knows the
pool ID can obtain them. AWS's example record for CreateIdentityPool shows
the setting in requestParameters.allowUnauthenticatedIdentities, and the
UpdateIdentityPool API takes the same parameter. AWS documents for
UpdateIdentityPool that a parameter without a value is set to its default,
so callers send the whole configuration: an update of a pool that already
allowed guests matches too. Check whether guest access is new, and what
the unauthenticated role of the pool can do.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/cognito/latest/developerguide/understanding-amazon-cognito-entries.html
- https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_UpdateIdentityPool.html
- https://docs.aws.amazon.com/cognito/latest/developerguide/logging-using-cloudtrail.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:
eventSource: cognito-identity.amazonaws.com
eventName:
- CreateIdentityPool
- UpdateIdentityPool
requestParameters.allowUnauthenticatedIdentities: 'true'
condition: selection
falsepositives:
- Applications with a real guest mode, whose pools are created and updated with this setting by their deployment pipeline. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on calls made by people or unknown roles.
level: medium
False positives
- Applications with a real guest mode, whose pools are created and updated with this setting by their deployment pipeline. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on calls made by people or unknown roles.
Cognito Identity Pool Roles Set
Detects SetIdentityPoolRoles calls to Amazon Cognito identity pools. AWS describes the call as setting the roles for an identity pool, which are used when GetCredentialsForIdentity is called. The request carries a map of roles and optional role mappings per identity provider. Whoever changes them decides which IAM role the identities of the pool, including guests where the pool accepts them, receive credentials for. AWS documents that the identity pool operations other than the credential calls are logged as CloudTrail management events, with the event source cognito-identity.amazonaws.com as in its example record for CreateIdentityPool. It publishes no example for this call, so the rule matches the event name only: read the roles and role mappings of the request and compare them with the last deployed configuration. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: Cognito Identity Pool Roles Set
id: 377f9b33-bf8e-4561-a306-fe01d136859e
status: experimental
description: >-
Detects SetIdentityPoolRoles calls to Amazon Cognito identity pools. AWS
describes the call as setting the roles for an identity pool, which are
used when GetCredentialsForIdentity is called. The request carries a map
of roles and optional role mappings per identity provider. Whoever
changes them decides which IAM role the identities of the pool, including
guests where the pool accepts them, receive credentials for. AWS documents
that the identity pool operations other than the credential calls are
logged as CloudTrail management events, with the event source
cognito-identity.amazonaws.com as in its example record for
CreateIdentityPool. It publishes no example for this call, so the rule
matches the event name only: read the roles and role mappings of the
request and compare them with the last deployed configuration.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_SetIdentityPoolRoles.html
- https://docs.aws.amazon.com/cognito/latest/developerguide/logging-using-cloudtrail.html
- https://docs.aws.amazon.com/cognito/latest/developerguide/understanding-amazon-cognito-entries.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:
eventSource: cognito-identity.amazonaws.com
eventName: SetIdentityPoolRoles
condition: selection
falsepositives:
- Deployments that create an identity pool or change its roles, by pipelines, infrastructure-as-code tools and the console. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on calls made by people or unknown roles.
level: medium
False positives
- Deployments that create an identity pool or change its roles, by pipelines, infrastructure-as-code tools and the console. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on calls made by people or unknown roles.
Cognito User Pool MFA Turned Off
Detects SetUserPoolMfaConfig calls to Amazon Cognito user pools that set multi-factor authentication to OFF. AWS documents that the call sets user pool MFA to be on, off or optional. With MFA off, the password of a user is enough to sign in, and where the user pool feeds an identity pool, to obtain AWS credentials. AWS documents that all user pool actions are logged as CloudTrail management events, with the event source cognito-idp.amazonaws.com. The value is read from requestParameters.mfaConfiguration, which follows the MfaConfiguration request parameter of the user pools API reference (valid values OFF, ON and OPTIONAL): AWS publishes no example record for this call, so confirm the field in your own events. A change from ON to OPTIONAL is not matched. The MFA setting can also be sent in a general UpdateUserPool call, which this rule leaves out because that call repeats the setting on every update. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: Cognito User Pool MFA Turned Off
id: 3f1c9469-69eb-4211-8aae-20ec25785d87
status: experimental
description: >-
Detects SetUserPoolMfaConfig calls to Amazon Cognito user pools that set
multi-factor authentication to OFF. AWS documents that the call sets user
pool MFA to be on, off or optional. With MFA off, the password of a user
is enough to sign in, and where the user pool feeds an identity pool, to
obtain AWS credentials. AWS documents that all user pool actions are
logged as CloudTrail management events, with the event source
cognito-idp.amazonaws.com. The value is read from
requestParameters.mfaConfiguration, which follows the MfaConfiguration
request parameter of the user pools API reference (valid values OFF, ON
and OPTIONAL): AWS publishes no example record for this call, so confirm
the field in your own events. A change from ON to OPTIONAL is not
matched. The MFA setting can also be sent in a general UpdateUserPool
call, which this rule leaves out because that call repeats the setting on
every update.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SetUserPoolMfaConfig.html
- https://docs.aws.amazon.com/cognito/latest/developerguide/logging-using-cloudtrail.html
- https://attack.mitre.org/techniques/T1556/006/
author: Forestall
date: 2026-11-18
tags:
- attack.defense-impairment
- attack.persistence
- attack.credential-access
- attack.t1556.006
logsource:
product: aws
service: cloudtrail
detection:
selection:
eventSource: cognito-idp.amazonaws.com
eventName: SetUserPoolMfaConfig
requestParameters.mfaConfiguration: 'OFF'
condition: selection
falsepositives:
- Test and development user pools that are set up without MFA, and deployments that apply the same configuration again. Add the deployment roles of such pools to a filter_* selection on userIdentity.arn, and treat every match on a production pool as a change to confirm.
level: medium
False positives
- Test and development user pools that are set up without MFA, and deployments that apply the same configuration again. Add the deployment roles of such pools to a filter_* selection on userIdentity.arn, and treat every match on a production pool as a change to confirm.
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.
Role set on an identity pool is on your list of privileged roles
Applications give identity pools narrow roles for end users. The change that matters puts an administrator or IAM-capable role behind a pool, and only your own list of privileged roles tells the two apart.
- Collect
SetIdentityPoolRolesevents fromcognito-identity.amazonaws.comand read the role ARNs of the request (the Roles and RoleMappings parameters of the API). - Compare each role with your list of privileged roles, such as roles with administrator access or with IAM write permissions.
- Alert on a match, and check whether the pool named in the request accepts unauthenticated identities.
EventsSetIdentityPoolRoles
LimitsIt needs a maintained list of privileged roles. The role fields follow the API reference, and AWS publishes no example record for this call, so confirm them in your own events first.
Triage
- Identify the caller (userIdentity.arn), the source IP address and the user agent. Is it the deployment pipeline of the application that owns the pool?
- For SetIdentityPoolRoles, read the roles and role mappings of the request and compare what each role can do with what it could do before.
- For an identity pool with guest access, check the permissions of its unauthenticated role and whether the application has a guest mode at all.
- For a user pool, check whether MFA was required before and who asked for the change.
- Look at the activity of the roles behind the pool in CloudTrail after the change, with priority on new source addresses.
Response
Once the attack is confirmed:
- Put the last deployed configuration back, which means the intended roles, guest access off and MFA required.
- Revoke the active sessions of the roles behind the identity pool, so that credentials handed out in the meantime stop working.
- Review CloudTrail for what those roles did since the change, and remove what was created.
- For a user pool, review the sign-ins made while MFA was off and reset the passwords of affected users.
- Contain the principal that made the change, and review everything else it did.
Mitigation
- Allow the identity pool configuration actions and cognito-idp:SetUserPoolMfaConfig only to deployment roles and the team that owns the application.
- Keep guest access off unless the application needs it, and give the unauthenticated role only the few permissions guests need.
- Write the trust policy of every role used with Cognito so that it accepts only the intended identity pool and only authenticated or unauthenticated identities as meant.
- Keep MFA required for user pools whose users reach sensitive data or AWS credentials.
- Log Cognito identity pool data events for pools that hand out powerful roles, so that credential requests are visible.
Frequently asked questions
Why is an identity pool an access path into the AWS account?
An identity pool exists to hand out temporary AWS credentials. The roles set with `SetIdentityPoolRoles` are the ones used when `GetCredentialsForIdentity` is called. When the pool accepts unauthenticated identities, a caller needs no sign-in at all to receive credentials for the unauthenticated role. The pool is therefore as powerful as the roles behind it.
Does CloudTrail show who obtained credentials from the pool?
Only if data events for Cognito identity pools are logged. AWS documents that `GetId`, `GetCredentialsForIdentity` and `GetOpenIdToken` are data events, which CloudTrail does not log by default. The configuration changes are management events and are logged by default, which makes them the reliable signal.
Why does the guest access rule also fire on updates that changed something else?
AWS documents for `UpdateIdentityPool` that a parameter without a value is set to its default, so callers send the whole configuration every time. An update of a pool that already allowed guests carries the setting again. Check whether the pool accepted guests before the event.
Why is the user pool rule limited to one call?
The rule matches `SetUserPoolMfaConfig`, the call that sets MFA to on, off or optional, when the value is `OFF`. The MFA setting can also travel inside a general update of the user pool, where it is sent on every update of a pool without MFA, so a rule on that call would fire on routine changes.
References
- MITRE ATT&CK T1098.003: Account Manipulation: Additional Cloud Roles
- MITRE ATT&CK T1556.006: Modify Authentication Process: Multi-Factor Authentication
- Amazon Cognito logging in AWS CloudTrail
- Example Amazon Cognito events
- Amazon Cognito Federated Identities API Reference: SetIdentityPoolRoles
- Amazon Cognito Federated Identities API Reference: UpdateIdentityPool
- Amazon Cognito User Pools API Reference: SetUserPoolMfaConfig