How a Simple Graphql Vulnerability led to Admin Dashboard
A GraphQL endpoint had introspection enabled and exposed a query that returned user details by Base64-encoded user ID, allowing enumeration of staff accounts. A password-change mutation accepted OTP codes without rate limiting, and brute-forcing the OTP for an admin phone number yielded a JWT token that granted access to the admin dashboard.
medium.com
Published on medium.com
Hey everyone! My name is Rishi Beria, and I’m absolutely in love with cybersecurity.
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 GraphQL schema was exposed via introspection and included a user-lookup query that lacked proper authorisation, while the OTP verification mutation had no rate limiting.
Impact
An attacker could obtain a JWT token for a staff/admin account and access the admin dashboard, potentially taking over the account.
What the attacker needed
GraphQL endpoint with introspection enabled; No rate limit on OTP verification; Knowledge of admin phone number or user ID
The fix
The report recommends disabling GraphQL introspection in production and adding rate limiting or CAPTCHA to OTP verification, but does not state that these were implemented.
How it was found
- Query the GraphQL endpoint with an introspection request to list schema types.
- Use Burp Suite with the InQL extension to enumerate queries and mutations and obtain a JSON copy of the schema.
- Identify a query that takes a Base64-encoded user ID and returns user details including staff/admin status.
- Try user ID 1 and confirm it belongs to a staff/admin user.
- Trigger the OTP mechanism for the admin's phone number and brute-force the six-digit code, focusing on the range 700000 to 999999.
- Use the correct OTP to obtain a JWT auth token and access the admin dashboard.
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.
GraphQL is a way for apps to ask a server for exactly the data they need. Here, the server let anyone list all its available queries and also let anyone look up user details by guessing a simple number. Separately, a password-reset step used a six-digit code but never limited how many times someone could try, so an attacker could keep guessing until they got in.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.