How I Found Aws Api Keys Using Trufflehog And Validated Them Using Enumerate Iam Tool
A website's JavaScript source code exposed both an AWS access key and secret key in plain text. The author validated the keys with a tool and found they granted only basic account information, with no further impact.
Published on infosecwriteups.com
I started Bug hunting somewhere after the summer in 2022 due to my interest in it.
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 AWS credentials were hard-coded in client-side JavaScript that was publicly accessible.
Impact
The exposed keys could allow an attacker to access the AWS account, but in this case they only provided basic information with no useful impact.
What the attacker needed
Trufflehog browser extension installed; Target website with exposed keys
How it was found
- Install the Trufflehog browser extension.
- Visit a target website with the extension active.
- Note the pop-up alerting to AWS API keys and the path where they are found.
- Open the indicated path and locate the AWS access key and secret key in the source.
- Run the enumerate-iam tool against the leaked keys to validate them.
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.
Websites often include JavaScript files that run in your browser. Sometimes developers accidentally leave secret passwords, called API keys, inside that code. Here, both an AWS access key and secret key were visible, which could let someone use the website owner's cloud account, but in this case the keys only allowed reading basic account details.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.