The Authorization Circus: Where Security Was the Main Clown
The API's role management endpoint was vulnerable to privilege escalation because it trusted client-supplied data such as duplicate JSON properties, custom headers, cookies, and query parameters to determine user roles. An attacker with a basic user account could escalate to admin and access sensitive admin endpoints.
medium.com
Published on medium.com
Free Link🎈
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 server-side authorization logic trusted client-controlled input (such as duplicate JSON keys, custom headers, cookies, and query parameters) to determine user roles instead of using a secure server-side session context.
Impact
An attacker with a basic user account could escalate privileges to admin and access sensitive administrative endpoints, potentially leading to full system compromise.
What the attacker needed
A basic user account
The fix
The authorization system was overhauled to remove client-controlled role parameters, implement server-side authorization context, add consistent middleware, enhance audit logging, and conduct security training.
How it was found
- Send a PATCH request to /api/v3/users/me/roles with a JSON body containing duplicate 'roles' properties, where the last one sets roles to admin and super_admin.
- Observe a 200 OK response indicating roles were updated successfully.
- Access an admin endpoint such as /api/v3/admin/dashboard with custom headers like X-User-Role: admin to gain admin access.
- Access another admin endpoint with cookies like user_role=admin to retrieve system configuration.
- Send a GET request to /api/v3/users with duplicate 'role' query parameters (role=user&role=admin) to obtain admin-level user data.
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.
This report shows how a web application's permission checks could be tricked. The server mistakenly believed the user's role when it was sent in multiple ways, like extra headers or cookies, instead of checking the real role stored on the server. So a normal user could pretend to be an admin and see things they shouldn't.
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.