Exploiting Misconfigured GraphQL
A GraphQL endpoint had introspection enabled and exposed user details, including credentials. The author then used queries to change an exposed user's password, log in as that user, and create a new admin account without authentication.
medium.com
Published on medium.com
It’s all about API testing. I’m not going to explain it — go do some research, hehehe.
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 endpoint had introspection enabled and its queries lacked proper authentication and authorisation checks.
Impact
An attacker could read user details, take over an existing account by resetting its password, and create an admin account without authentication.
What the attacker needed
Reachable GraphQL endpoint; introspection enabled; no auth on some queries
The fix
The GraphQL endpoint should be configured correctly, with introspection disabled in production and authentication and authorisation enforced on every query and mutation.
How it was found
- Find a GraphQL endpoint on the target.
- Run an introspection query to list the schema.
- Send a user query and read the exposed user details.
- Try the exposed credentials, which did not work.
- Send a query to update the exposed user's password.
- Log in as that user, then use a createUser query to make an admin account.
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. If it is set up badly, anyone can ask it to list all its data types and then request sensitive records. Here the server returned user details and even let the author change passwords and create admin accounts.
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.