User Role Controlled by Request Parameter: I Became Admin by Changing One Cookie (PortSwigger Lab Walkthrough)
A step-by-step PortSwigger lab walkthrough: when you log in, the site gives your browser a cookie, Admin=false, and then trusts whatever comes back. Intercept the request in Burp Suite, change false to true, and the admin panel opens.

Difficulty: Apprentice
Category: Access control
Lab: User role controlled by request parameter
The website decides who is admin with a cookie. The cookie lives in your browser, so you decide.
This is the third lab in this access control series, after Unprotected admin functionality and Unprotected admin functionality with unpredictable URL. This time you need Burp Suite.
The goal

The admin panel is at /admin, and it identifies administrators using a forgeable cookie. To solve the lab, open the admin panel and delete the user carlos. You can log in to your own account with wiener:peter.
Step 1: Log in
Open the lab, go to My account, and log in as wiener with the password peter.

Step 2: Try the admin panel
Visit /admin. It's not available to you:

Step 3: Intercept the request and flip the cookie
In Burp Suite, turn Intercept on, then visit /admin again. Burp catches the request before it reaches the server:

Look at the cookie header:
Cookie: Admin=false; session=...false means you are not the admin, and true means you are. Change it to true, then forward the request.

The admin panel is now accessible:

Step 4: Delete carlos
Click Delete next to carlos. That's a new request, which also carries Admin=false, so intercept it and change the cookie to true again before forwarding it.

The user is deleted, and the lab is solved.

What was going on?
The server was sending a cookie, and then deciding from that cookie whether the logged-in user is an admin. That is not a good practice.
A cookie is stored in the browser, on the user's own machine. Anything on that side of the trust boundary can be read and changed by the user, whether with Burp Suite, the browser's developer tools, or a script. So when the server asks the browser "are you an admin?", the browser can simply say yes.
The fix
- Keep the role on the server. The cookie should only carry a random session ID. The server looks up who that session belongs to and what their role is in its own records, and checks that role on every request to the admin panel.
- If a role must travel in a token, sign it and verify the signature on every request, so any change made by the user is rejected.
The server must not rely on anything the user can change to decide who is admin.
Watch the video walkthrough
https://www.youtube.com/@devsecknight
References
| Resource | Why it is useful |
|---|---|
| PortSwigger Lab: User role controlled by request parameter | The official lab used in this walkthrough. |
| PortSwigger: Access control vulnerabilities | PortSwigger's guide to broken access control, including parameter-based access control methods. |
| OWASP Top 10: Broken Access Control | Why broken access control is the number one web application risk. |
This is a PortSwigger practice lab, built to be hacked. Only test systems you own or have written permission to test. Security audits and private pentests: click to reveal email

