🗂️PortSwigger Lab Writeup: Method-Based Access Control can be Circumvented

🎯 Objective
The objective of this lab is to exploit a broken access control where the app has an admin panel which implements access controls based partly on the HTTP method of requests. The goal is to find a flawed access controls and exploit it to promote yourself to become an administrator.
- Lab URL:
https://portswigger.net/web-security/access-control/lab-method-based-access-control-can-be-circumvented - Category: Access Control
- Difficulty: Practitioner
🧪 Exploitation Steps
🕵️Step 1: Observe the Website
- Firstly open the lab URL in your browser, and observe what it is about and how it works.


- At first glance, the website seems to be a shopping website with a login page. In the lab description, it is mentioned that we need to promote user
wienerto administrator by exploiting any flawed access control.
📝Step 2: Try Accessing Admin Panel
- Click on Admin Panel and see the normal response.

- Now, Login with the administrator credentials to find any flawed access control in admin panel.

- Now. again open the Admin Panel and see how it works.

- Here we have a feature to make other users Admin. Lets test by making carlos an Admin.
- Now, Open the HTTP History in Burpsuite and see the
POST /admin-rolesrequest and its response.
- Hence, this endpoint
/admin-rolescan be used for exploitation and make the userwieneradmin without any authentication from Administrator.
🧑💼Step 3: Promote wiener to Admin
- Login with the wiener credentials -
wiener:peter - Open the admin panel to log this request in Burpsuite.

- Now send this request to Repeater using
Ctrl + R. - Modify the
GET /adminrequest toGET /admin-roles?username=wiener&action=upgradeand sent the request.
- Hence, we successfully promoted the user wiener to Administrator.
- And Finally, the Lab is solved.

🧠 Conclusion
- This lab demonstrated how method-based access control can be flawed when authorization depends on HTTP methods. By invoking
GET /admin-roles?username=wiener&action=upgrade, we bypassed intended POST-only checks and escalated privileges. - The impact is high — attackers can alter roles or perform privileged actions by switching methods or calling alternate routes that lack proper server-side authorization.
- Fix: enforce server-side authorization regardless of HTTP method, validate user permissions for every action, restrict sensitive endpoints to the correct method and verify it server-side, and use centralized authorization checks rather than method-based assumptions.