Skip to content
Misconfiguration Write-up Intermediate

The .env File Was Just Sitting There: How a Single Cognito Misconfiguration Unlocked a Fintech’s…

A Cognito identity pool returned live AWS credentials to the browser, and those credentials had read access to production S3 buckets. The attacker used them to list buckets, find a folder named secrets, and download a production .env file containing database credentials, encryption keys, Redis URLs and an ERP password.

srck_ Follow

Published on medium.com

The client operates in financial services. Real users.

SRCK, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Cognito identity pool was configured to return AWS credentials to the browser and its role allowed reading production S3, where a .env file with secrets was stored.

Impact

An attacker could read production S3 data and obtain database, encryption, Redis and ERP credentials, enabling lateral movement and compromise of user data; the credentials expired after one hour but that did not prevent the exposure.

What the attacker needed

Authorized bug bounty scope; victim uses the web app; no account needed to observe

The fix

The organisation acknowledged the finding and remediated the issue; the write-up recommends server-side token exchange, least-privilege identity pool roles, moving secrets to Secrets Manager, deny-by-default bucket policies and rotating all exposed secrets.

How it was found

  1. Intercept the browser's request to Cognito GetCredentialsForIdentity in Burp Suite.
  2. Observe the response contains AccessKeyId, SecretKey and SessionToken.
  3. Export the credentials and run aws s3 ls to list buckets.
  4. List the production bucket and spot a secrets/ prefix.
  5. Download the .env file from that prefix.
  6. Enumerate IAM users and their attached policies.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

AWS Cognito is a login service. When set up wrongly, it can hand out temporary cloud keys to whoever is using the website. Here those keys could read private storage, and a file full of passwords was sitting in that storage.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by srck_

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.