A brass key revealed between translucent layers of public web assets.
Original cinematic editorial image created for this archive edition.

Hello everyone. This article explains how I look for exposed API keys and validate whether they can be used for authentication.

Find Secret API Key title illustration over a map with a key icon.
An Application Programming Interface key (API key) is a credential used by an application or service to identify or authorize a caller. The permissions and data it exposes depend on the provider and the credential's configured scope.

API keys can be found in multiple ways, but the simplest method would be visiting the GitHub page of the desired program or checking the source code.

Manual review can be time-consuming, so this is one tool I recommend for speeding up the process:

KeyFinder

GitHub - momenbasel/keyFinder: Keyfinder is a tool that let you find keys while surfing the web!

It's easy to install and use

  1. Clone the repo or download it via https://github.com/momenbasel/keyFinder.git
  2. Open Chrome and go to chrome://extensions
  3. Enable "Developer Mode"
  4. Drag and drop the KeyFinder folder

After installing KeyFinder, visit the target website and click the KeyFinder icon in Chrome. Add common keywords associated with API keys so the extension can inspect the site. After visiting the relevant links, open the results to review what it found.

The next question is how to validate a key. Some API keys can authenticate requests without an individual user's username and password.

The examples below are retained for historical context. Provider APIs, token formats, and recommended transports change, and some examples are now deprecated or place secrets in URLs. For current authorized testing, consult the provider's latest documentation, prefer headers or secure SDK flows, validate only the minimum required impact, and never paste real credentials into third-party tools or logs.

Slack API token

curl -sX POST "https://slack.com/api/auth.test?token=xoxp-TOKEN_HERE&pretty=1"

Facebook Access Token

https://developers.facebook.com/tools/debug/accesstoken/?access_token=ACCESS_TOKEN_HERE&version=v3.2

GitHub Token

curl -s -u "user:apikey" https://api.github.com/user
curl -s -H "Authorization: token TOKEN_HERE" "https://api.github.com/users/USERNAME_HERE/orgs"
# Check scope of your api token
curl "https://api.github.com/rate_limit" -i -u "user:apikey" | grep "X-OAuth-Scopes:"

Twitter API Secret

curl -u 'API key:API secret key' --data 'grant_type=client_credentials' 'https://api.twitter.com/oauth2/token'

SendGrid API Token

curl -X "GET" "https://api.sendgrid.com/v3/scopes" -H "Authorization: Bearer SENDGRID_TOKEN-HERE" -H "Content-Type: application/json"

AWS Access Key ID and Secret

Install awscli, set the access key and secret to environment variables, and execute the following command:

AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=yyyy aws sts get-caller-identity

AWS credentials' permissions can be determined using Enumerate-IAM. This gives a broader view of the discovered AWS credentials privileges instead of just checking S3 buckets.

git clone https://github.com/andresriancho/enumerate-iam
cd enumerate-iam
./enumerate-iam.py --access-key AKIA... --secret-key StF0q...

Heroku API Key

curl -X POST https://api.heroku.com/apps -H "Accept: application/vnd.heroku+json; version=3" -H "Authorization: Bearer API_KEY_HERE"

Instagram Access Token

https://api.instagram.com/v1/users/self/?access_token=ACCESS-TOKEN

Spotify Access Token

curl -H "Authorization: Bearer <ACCESS_TOKEN>" https://api.spotify.com/v1/me

Zendesk Access Token

curl https://{subdomain}.zendesk.com/api/v2/tickets.json \
-H "Authorization: Bearer ACCESS_TOKEN"
Reference:
You can find more useful keys here: https://github.com/streaak/keyhacks
https://community.turgensec.com/finding-hidden-api-keys-how-to-use-them/

Secretx

xyele/secretx

Secretx extracts API keys from each requested URL.

Usage
python3 secretx.py --list urlList.txt --threads 15

Best of luck everyone. Keep-Hacking!

Feedback and corrections are welcome.

Twitter, Linkedin

If this article helped, share it with another researcher who might find it useful.

Continue reading

From research to a scoped assessment.

Explore API penetration testing or browse the full Bug Bounty Archive for more evidence-focused research.

Research topics: hacking / bug-bounty / cybersecurity / api