Skip to content
Access control Write-up Beginner

(BAC)User role can be modified in user profile

The profile update endpoint accepted a role parameter from the client without any permission check, so the server stored whatever role value was sent. An attacker could change their own role from a normal user to an administrator and gain elevated permissions.

medium.com

Published on medium.com

hello hacker Continuing the (BAC) series Today we explain a New point in Brocken Access Control It is User role can be modified in user profile

Abdallh Mohamed, on medium.com

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 profile update handler bound client-supplied fields directly to the user record, including the role, with no server-side authorisation check on that field.

Impact

An attacker could raise their own privileges to administrator, giving them access to administrative functions and other users' data.

What the attacker needed

A free account; ability to intercept and edit requests

The fix

The server should check permissions on every request and never let client input set fields such as role, for example by allow-listing which profile fields can be updated.

How it was found

  1. Intercept the profile update request and change the email address to confirm the request works.
  2. Add or modify the role parameter, changing its value from 1 to 2.
  3. Send the request and observe that the role was updated.
  4. Change the identifier from a normal user to admin using the same method.
  5. Confirm the account now has administrator access.

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.

When you edit your profile, your browser sends fields to the server, such as your email address. Here the server also accepted a field describing your role, meaning whether you are a normal user or an administrator, and it saved it without checking whether you were allowed to change it. So anyone could simply send a different role value and make themselves an administrator.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.