🗂️PortSwigger Lab Writeup: UserID Controlled by Request Parameter with Password Disclosure

🎯 Objective
The objective of this lab is to exploit a broken access control where the app has a horizontal privilege escalation vulnerability on the user account page with password prefilled in a masked input. The goal is to access the admin panel and delete the user carlos.
- Lab URL:
https://portswigger.net/web-security/access-control/lab-user-id-controlled-by-request-parameter-with-password-disclosure - Category: Access Control
- Difficulty: Apprentice
🧪 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 access the admin panel and then delete the account of
carlos.
📝Step 2: Retrieve Admin Credentials
- Login with the credentials of user wiener to access the account page first.

- Now, On user account page
/my-account?=winerwe can see the masked password of wiener. - Change the
/my-account?=winerto/my-account?=administratorto access the account page of administrator.
- Now, Open the source code and Copy the password of Administrator.
🧑💼Step 3: Delete carlos
- Login with the administrator credentials to access the admin panel.

- Click on the Admin Panel.

- Click on the Delete option for carlos to delete the account.

- And Finally, the Lab is solved.
🧠 Conclusion
- This lab demonstrated how password disclosure in masked input fields combined with horizontal privilege escalation enables complete account compromise. By changing the user parameter and viewing the HTML source, we extracted the administrator password and escalated privileges.
- The impact is critical — sensitive information like passwords should never be prefilled in input fields, even if masked. Client-side masking provides no security as attackers can always inspect the HTML source or intercept the response.
- Fix: never prefill sensitive fields like passwords, implement proper access control to prevent parameter-based enumeration, validate server-side that users can only access their own data, use secure password storage and transmission, and ensure sensitive data is not exposed in any part of the response including hidden form fields.