For the complete documentation index, see llms.txt. This page is also available as Markdown.

Access Control Vulnerabilities (Labs: PortSwigger Academy)

Broken Authentication: When a user access resources or perform actions that they are not supposed to be able to.

Labs from PortSwigger Academy

🟩🟩 APPRENTICE 🟩🟩

Lab 1: Unprotected admin functionality

visiting /robots.txt give 
Disallow: /administrator-panel

we can simply visit the url and delete the user carlos 

Lab 2: Unprotected admin functionality with unpredictable URL

Visiting page source leaks admin panel url 

Lab 3: User role controlled by request parameter

Each request hash cookie
Cookie: session=sDBAEXHgc<snip>mYoXfa9M9pb; Admin=false

we can simply edit Admin value to true in each request to get administrative access

Lab 4: User role can be modified in user profile

while updating email of the account we get following as response

request: 
{"email":"test@gmail.com"}

response:
{
  "username": "wiener",
  "email": "test@gmail.com",
  "apikey": "9kAv<snip>ZVRIlZJ79",
  "roleid": 1
}

now, we can add roleid field in change-email request

request:
{
	"email":"test@gmail.com",
	"roleid":2
}

response:
{
  "username": "wiener",
  "email": "test@gmail.com",
  "apikey": "9kAvthjfqQN77Hvd0UVNVt4ZVRIlZJ79",
  "roleid": 2
}


We now have roleid = 2 and this role has administrator privilege

Lab 5: User ID controlled by request parameter

This lab has a horizontal privilege escalation vulnerability on the user account page. To solve the lab, obtain the API key for the user carlos and submit it as the solution. You can log in to your own account using the following credentials: wiener:peter

Lab 6: User ID controlled by request parameter, with unpredictable user IDs

This lab has a horizontal privilege escalation vulnerability on the user account page, but identifies users with GUIDs. To solve the lab, find the GUID for carlos, then submit his API key as the solution. You can log in to your own account using the following credentials: wiener:peter

Lab 7: User ID controlled by request parameter with data leakage in redirect

This lab contains an access control vulnerability where sensitive information is leaked in the body of a redirect response. To solve the lab, obtain the API key for the user carlos and submit it as the solution. You can log in to your own account using the following credentials: wiener:peter

Lab 8: User ID controlled by request parameter with password disclosure

This lab has user account page that contains the current user's existing password, prefilled in a masked input. To solve the lab, retrieve the administrator's password, then use it to delete the user carlos. You can log in to your own account using the following credentials: wiener:peter

Lab 9: Insecure direct object references

This lab stores user chat logs directly on the server's file system, and retrieves them using static URLs. Solve the lab by finding the password for the user carlos, and logging into their account.

🟦🟦 PRACTITIONER LABS 🟦🟦

Lab 10: URL-based access control can be circumvented

This website has an unauthenticated admin panel at /admin, but a front-end system has been configured to block external access to that path. However, the back-end application is built on a framework that supports the X-Original-URL header.

To solve the lab, access the admin panel and delete the user carlos.

Why it works (brief)

  • The front-end or proxy blocks direct requests to /admin by inspecting the request URL and returning 403.

  • However, the backend framework determines routing based on the X-Original-URL header (used by some reverse proxies and internal routers).

  • When you send a request like: GET /?username=carlos X-Original-URL: /admin/delete/

  • the proxy accepts it (because the visible path is /) and forwards it to the backend.

  • The backend then reads X-Original-URL for routing and the query string (?username=carlos) from the real URL, combining them into an internal request to /admin/delete/?username=carlos.

  • This lets you reach and trigger the admin delete function even though /admin is blocked externally.

Lab 11: Method-based access control can be circumvented

This lab implements access controls based partly on the HTTP method of requests. You can familiarize yourself with the admin panel by logging in using the credentials administrator:admin.

To solve the lab, log in using the credentials wiener:peter and exploit the flawed access controls to promote yourself to become an administrator.

Lab 12: Multi-step process with no access control on one step

This lab has an admin panel with a flawed multi-step process for changing a user's role. You can familiarize yourself with the admin panel by logging in using the credentials administrator:admin.

To solve the lab, log in using the credentials wiener:peter and exploit the flawed access controls to promote yourself to become an administrator.

Lab 13: Referer-based access control

This lab controls access to certain admin functionality based on the Referer header. You can familiarize yourself with the admin panel by logging in using the credentials administrator:admin.

To solve the lab, log in using the credentials wiener:peter and exploit the flawed access controls to promote yourself to become an administrator.

Last updated