🗂️PortSwigger Lab Writeup: Insecure Direct Object References

🎯 Objective
The objective of this lab is to exploit a broken access control where the app has an IDOR vulnerability. The goal is to retrieve the password of user carlos and log in onto their account.
- Lab URL:
https://portswigger.net/web-security/access-control/lab-insecure-direct-object-references - 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 and live chat feature. In the lab description, it is mentioned that we need to find the password of
carlos.
📝Step 2: Find IDOR
- Test the Live chat feature to see if there is any vulnerability.

- Click on View transcript to see what happens.
- We see that a file named
2.txtis being download from a URL.
- This might be the place where there is IDOR.
- Now, Copy this URL and change the
2.txtto1.txt
- A new file named
1.txtis being downloaded. - Open this file and we find a password in this which may be the password of carlos.

🧑💼Step 3: Login as carlos
- Login as carlos with the password we got from the
1.txtfile.
- And Finally, the Lab is solved.

🧠 Conclusion
- This lab demonstrated Insecure Direct Object References (IDOR) through predictable file identifiers. By sequentially changing the filename from
2.txtto1.txt, we accessed another user's transcript file containing their password without any authorization checks. - The impact is critical — IDOR vulnerabilities allow attackers to access, modify, or delete any user's data by simply guessing or enumerating object identifiers, leading to account compromise and data breaches.
- Fix: implement proper access control checks on all object references, validate that the current user has permission to access the requested resource, use cryptographically strong and unpredictable identifiers (UUIDs) instead of sequential numbers, and avoid relying on user input alone to identify objects without server-side authorization validation.