URL-based access control can be circumvented
URL-based access control can be circumvented: This lab uses a front-end system to block access to /admin, but the back-end supports the X-Original-URL header. To solve the lab, use this header to bypass restrictions and delete the user carlos. • PortSwigger • Access control vulnerabilities • X-Original-URL
Bypassing Front-End Restrictions with X-Original-URL
🎯 Objective
This lab uses a front-end system to block access to /admin, but the back-end supports the X-Original-URL header.
To solve the lab, use this header to bypass restrictions and delete the user carlos.
🧭 Strategy
- The front-end restricts direct access to
/admin. - Back-end routing via the
X-Original-URLheader may bypass it. - Inject this header to reroute requests server-side while preserving front-end restrictions.
🔎 Analysis
1. 🧪 Test Header Injection
First, test with a dummy path to confirm if the back-end accepts header overrides:
X-Original-URL: /doesnotexist/This checks if the back-end is influenced by the injected path.

2. 🛠️ Access the Admin Panel
Update the header with the real endpoint:
X-Original-URL: /adminThis bypasses the front-end restrictions and reveals the admin panel.

3. ⚠️ Handling Parameters
Since X-Original-URL doesn’t support query parameters directly, pass them in the main request path:
GET /?username=carlos HTTP/2
X-Original-URL: /admin/deleteThis routes the request to /admin/delete while supplying username=carlos via query parameters.

4. ✅ Carlos Deleted
Final crafted request successfully deletes the user carlos.

📝 Action Plan
- Log in and intercept a request.
- Add the header:
X-Original-URL: /admin - Confirm access to the admin panel.
- Craft the final request:
GET /?username=carlos X-Original-URL: /admin/delete - Send the request and verify
carlosis deleted.