AWS Cognito Identity Pool Misconfiguration
Table of Contents
Amazon Cognito Identity Pools (Federated Identities) can issue temporary AWS credentials to unauthenticated visitors — this is a supported, documented feature, used by apps that want to save per-visitor state (preferences, carts, wellness profiles, etc.) without requiring an account. The vulnerability isn't the feature itself; it's that the IAM role attached to the pool's "unauthenticated" identity is frequently over-permissioned relative to what the frontend actually needs.
The critical distinction to carry into PT1 classification: what the
application calls (e.g. a scoped DynamoDB:GetItem keyed to the
visitor's own record) is not a security control. It's convention.
Once you hold valid credentials for that IAM role, you can call any
action the role's policy allows — regardless of what the JS ever
does. The enforcement gap sits in the cloud IAM policy, not the app
code. This looks similar to BOLA/IDOR (reading another user's
record) but is a distinct root cause and should be classified
separately: BOLA is a missing authorisation check in application
logic; this is missing least-privilege in an IAM policy (frequently:
table/bucket-level grant with no dynamodb:LeadingKeys condition or
equivalent row/object-level restriction).
Related: Identity and Access Management (IAM) BOLA Insecure Direct Object References AWS CLI PT1 Vulnerability Classification Cheat Sheet
1. Identifying Candidates
Look for frontend-only apps (often static, S3-hosted) with no visible login flow that still persist per-visitor state. Check source/JS for:
# Signs of Cognito unauthenticated identity usage
- AWS.config.credentials = new AWS.CognitoIdentityCredentials({...})
- An IdentityPoolId of the form: <region>:<uuid>
- Direct AWS SDK calls (DynamoDB, S3, etc.) made client-side
- LocalStorage keys prefixed aws.cognito.identity-id.*
The Identity Pool ID is the only thing required to request guest credentials — it's meant to be public (it's shipped in client-side JS by design), so finding it is not itself a finding.
2. Obtaining Guest Credentials
aws cognito-identity get-id \ --identity-pool-id <region>:<pool-uuid> \ --region <region> aws cognito-identity get-credentials-for-identity \ --identity-id <IdentityId-from-above> \ --region <region>
Export the returned triple and confirm what you're assuming:
export AWS_ACCESS_KEY_ID="..." export AWS_SECRET_ACCESS_KEY="..." export AWS_SESSION_TOKEN="..." aws sts get-caller-identity
get-caller-identity returns the assumed role ARN — this tells you
the exact IAM role name to reason about, e.g.
arn:aws:sts::<account>:assumed-role/<pool-name>-cognito-unauth-role/...
3. Testing Beyond the App's Own Calls
The app only ever performs the specific SDK calls its JS contains. Test adjacent/broader actions on the same service, and other services entirely — the IAM policy attached to the role is the real boundary, not the frontend:
# If the app does GetItem, try table-wide or account-wide actions: aws dynamodb scan --table-name <table> --region <region> aws dynamodb list-tables --region <region> # Check other services the role might also reach: aws s3 ls aws s3 ls s3://<bucket-name-if-known> aws iam list-attached-role-policies --role-name <role-from-caller-identity>
A Scan succeeding where the app only ever performs GetItem
confirms the policy grants broader access than the app's own logic
implies — that gap is the finding.
4. Notes
- Table/bucket names sharing a naming pattern (e.g.
complimentary-*) are worth probing for siblings — a "complimentary" or "guest" resource often has a non-complimentary counterpart (staff/VIP/admin data) reachable by the same over-permissioned role - Cognito-issued credentials are short-lived (typically ~1 hour) — this reduces real-world risk from a leaked token but does not reduce the severity of the underlying IAM misconfiguration; the root cause is reproducible on demand by anyone who can reach the identity pool
aws iam list-attached-role-policies/get-role-policywill often fail under the unauth role itself (no IAM read permissions) — don't treat that failure as "nothing more to find," it just means policy enumeration isn't part of this role's grant