From Exposed API Key to Arbitrary Account Creation: A GraphQL Bug
An AWS AppSync API key was exposed in a public JavaScript file, allowing access to a GraphQL endpoint that otherwise returned 401 without the key. With the key, the attacker could perform schema introspection and arbitrary mutations, including creating and updating user accounts.
Published on medium.com
In the world of bug bounty hunting, sometimes the most impactful vulnerabilities are found by chaining seemingly disparate issues. Recently, during an engagement on a well-known bug bounty platform, I encountered a fascinating case that evolved from a simple information disclosure into a critical access control…
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 API key was embedded in client-side JavaScript and the GraphQL endpoint relied solely on that key for authorisation, without additional access controls.
Impact
The exposed key allowed arbitrary GraphQL mutations, enabling unauthorised creation and modification of user accounts, and each request consumed AWS AppSync tokens, potentially leading to billing abuse.
What the attacker needed
Access to the public JavaScript file; No authentication required beyond the API key
How it was found
- Find the public JavaScript file on the main domain.
- Locate the exposed API key and GraphQL endpoint in that file.
- Send a request to the GraphQL endpoint without the key and observe a 401 response.
- Add the exposed key in the x-api-key header to gain access.
- Perform schema introspection to find mutable objects.
- Use a mutation query to create or update user accounts without authorisation.
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 secret key meant to protect an API was left in a public file that anyone can download. That key let the person bypass the login check and change data, such as creating user accounts, without permission.
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.