Breaking Boundaries: Vertical Privilege Escalation to Admin via I
The API allowed a user to change their own user_type from a normal value to an admin value via a crafted PUT request, and also allowed creation of new admin users via POST. An attacker could escalate their privileges to admin.
Published on medium.com
While reviewing the API endpoints, I identified one that returned user information based on a user ID. Upon further inspection, I noticed a parameter called usertype, which was set to 4.
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 missing server-side authorization checks on the user_type parameter, allowing users to modify their own role.
What the attacker needed
A valid user account; access to the API
The fix
The server should enforce proper authorization checks to prevent users from modifying their own user_type or creating users with elevated privileges.
How it was found
- Identify an API endpoint that returns user information based on a user ID and includes a user_type parameter.
- Observe that another user has user_type 1 (admin) while the attacker has user_type 4.
- Send a PUT request to update the user's own account, changing user_type to 1.
- Verify the change by querying the user information again.
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.
The application trusted a field called user_type that the user could change. By sending a request that set this field to the admin value, the attacker could make their account an admin. This is like being able to edit your own role in a system 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.