Skip to content
Access control Write-up Beginner

Exposed AWS AppSync API Key

A hardcoded AWS AppSync API key was found in frontend JavaScript, and it had permissions to perform GraphQL mutations, not just queries. An attacker could send unauthenticated requests to create arbitrary threads and pollute application data.

1sherlok Follow

Published on medium.com

Hello everyone, I’m Sherlok, and today I’d like to share a story about how I found a hardcoded AWS AppSync API key in the frontend JavaScript.

1sherlok, 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

The backend trusted any request carrying the API key for write operations, and the key was exposed in client-side code.

Impact

An attacker could create arbitrary threads without authentication, pollute application data, abuse backend business logic, and perform spam or automated resource creation, affecting data integrity and trust.

What the attacker needed

Access to the frontend JavaScript; the exposed API key; network access to the GraphQL endpoint

The fix

The API key should not be exposed in frontend code, and the backend should require proper authentication for mutations rather than trusting the key alone.

How it was found

  1. Check JavaScript files during recon and find a hardcoded AWS AppSync API key.
  2. Use a curl POST command to test whether the key works.
  3. Send a GraphQL mutation request with the key to create new objects such as threads.

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 frontend JavaScript file is code that runs in a visitor's browser, so anything inside it can be read by anyone. Here it contained an API key, which is like a password for a service. That key was allowed to write data, so anyone could use it to add content without logging in.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 1sherlok

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.