Skip to content
Access control Write-up Beginner

(BAC)User role controlled by request parameter

The application decided whether a user was an administrator by reading a cookie value sent by the browser, so the role was fully under the user's control. By changing that cookie from false to true, an attacker could reach the admin panel and delete another user without any authorisation check.

medium.com

Published on medium.com

In secure programming, the server should determine the user’s role (Admin, User, Editor) based on secure data stored in the database and linked to its session/JWT system on the server side only.

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 server used a client-supplied cookie to decide the user's privilege level instead of looking up the role stored server-side against the session.

Impact

An attacker could gain administrator privileges and perform admin-only actions such as deleting other users.

What the attacker needed

A free account; ability to edit cookies

The fix

The role should be determined only on the server from data tied to the session, and sensitive fields should never be accepted from client input.

How it was found

  1. Log in to the application with the provided low-privilege account.
  2. Inspect the request and notice the cookie that carries the admin flag.
  3. Change that cookie value from false to true and resend the request.
  4. Open the admin panel, which is now accessible, and delete the user Carlos.

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 cookie is a small piece of data the browser sends back to a website on every request. Here the site trusted a cookie to say whether you are an admin, and cookies can be edited freely by the person using the browser. So anyone could simply flip the value and be treated as 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.