JS Review and Abuse GraphQL Result 10xBAC + Admin Panel ATO
The author reviewed the JavaScript bundle of a MERN/GraphQL admin dashboard and found GraphQL mutations that let them create a user with an administrative role, gaining access to the admin panel. Inside the panel, several operations returned success even when the authorisation token was removed, indicating broken access control on user, order and store actions.
Here I will Demonstrate a part of My Methodology Related to NodeJS + React AKA MERN Apps
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 backend trusted a client-supplied role field when creating users and did not enforce authorisation checks on several admin operations.
Impact
An attacker could create an administrative account and then perform create, update, delete and view actions on users, orders and stores without a valid authorisation token.
What the attacker needed
Access to the admin dashboard; ability to read the JS bundle; no valid account needed
How it was found
- Map the scope and find the administration dashboard, which has no registration function.
- Try fuzzing a register endpoint and swapping login for register in the request; both fail.
- Notice the stack is GraphQL, React and Node.js, then search the JavaScript files for keywords such as user and login.
- Beautify and review the relevant JavaScript chunk to recover the GraphQL mutations and operations.
- Send a create-user mutation, adjust the role value until it is accepted, and log in to the admin panel.
- Remove the authorisation token from admin requests and observe that they still return 200 OK.
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 web app's front-end code is sent to every visitor's browser, so anyone can read it. Here the author read that code to learn the hidden GraphQL requests the admin panel uses, then sent one of them to create an account with an admin role. Once inside, they noticed that some actions still worked after removing the login token, meaning the server was not checking who was asking.
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.