Unveiling a Critical Vulnerability: Exposing AWS Credentials in a Penetration Test
AWS access keys and a secret were hardcoded in the source of a custom login page. Using them, the tester reached production server metadata and customer data.
Published on notifybugme.medium.com
Greetings, everyone! I’m Santosh Kumar Sha, a cloud security researcher from Assam, India.
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, developers hardcoded long-lived AWS credentials directly in the login page's source instead of storing them in a secret manager or using temporary IAM roles.
Impact
Anyone viewing the page could use the keys to access and manipulate AWS resources, launch instances, incur costs and steal data from services such as S3 and RDS.
What the attacker needed
Access to the public login page
The fix
The credentials were revoked and replaced, and the client was advised to use environment variables, IAM roles, AWS Secrets Manager and automated monitoring.
How it was found
- Gather URLs and subdomains from archives and passive sources, keeping ones with parameters.
- Browse the main domain and find the login.php endpoint.
- Fuzz the login page for a while without finding issues.
- View the source code of the login page.
- Find the AWS access key and secret in the source.
- Use the credentials to access production server metadata and customer data.
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.
A web page's source code is what the browser receives, so anyone can read it. The developers had put the keys to their cloud account directly in that code, like taping a house key to the front door. Anyone who viewed the page could pick up those keys and use the company's cloud account.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.