Objective: In this lab, students will investigate Insecure Direct Object Reference (IDOR) vulnerabilities, which occur when an application exposes internal object references (such as database keys, file names, or user IDs) to the user without proper access control. Students will learn how to identify and exploit IDOR vulnerabilities and explore mitigation strategies.
IDOR vulnerabilities allow attackers to manipulate references to access data they shouldn't be authorized to view or modify. By tampering with parameters like user IDs or file paths, attackers can bypass authorization mechanisms and gain access to restricted resources.
- Internet access
- A web browser
- A vulnerable web application or lab environment such as DVWA, OWASP Juice Shop, or Mutillidae
- Understanding IDOR:
IDOR occurs when internal object references (like user IDs, file names, etc.) are exposed to users without sufficient access control checks.- Example:
https://store.h4cker.org/orders/1234may display order information for Order ID 1234.
An attacker could change the URL tohttps://store.h4cker.org/orders/1235to view another user's order, exploiting an IDOR vulnerability.
- Example:
-
Question 1:
You want to determine if a web application has authorization-based vulnerabilities. Which two exploits would you attempt to identify such vulnerabilities?
(Choose all that apply.)- A) HTTP parameter pollution
- B) Insecure Direct Object Reference
- C) Default credentials
- D) Session hijacking
- E) Kerberos weakness
-
Testing for IDOR in User Accounts:
- Navigate to your web application and log in as a regular user.
- Locate a URL with an ID parameter that references a user profile, such as:
https://app.example.com/user/profile?user_id=1234 - Change the
user_idparameter to another user’s ID (e.g.,user_id=1235) and see if you can access or modify that user’s information.
Question 2: What happens when you change the user ID?
- Are you able to access another user's data?
- Does the application properly restrict access?
-
Testing File Access via IDOR:
- Some applications store sensitive documents with predictable URLs, such as:
https://app.example.com/download/file?file_id=5678 - Change the
file_idparameter to see if you can download files that do not belong to your account (e.g.,file_id=5679).
Question 3: Were you able to download unauthorized files by modifying the
file_id?- Explain the potential risks of such an attack if sensitive documents (e.g., invoices, contracts) are exposed via IDOR.
- Some applications store sensitive documents with predictable URLs, such as:
-
Order History Manipulation:
- Log in as a regular user and navigate to the order history section of an e-commerce site, such as:
https://shop.example.com/order/details?order_id=789 - Change the
order_idto another value to see if you can access details about other users' orders (e.g.,order_id=790).
Question 4:
- Were you able to view or modify the details of another user's order?
- If so, what sensitive information was exposed (e.g., customer name, address, payment information)?
- Log in as a regular user and navigate to the order history section of an e-commerce site, such as:
- Research Mitigation Techniques:
Conduct online research on how web applications can prevent IDOR vulnerabilities.- What are some common best practices for preventing unauthorized access to internal object references?
- How can developers ensure proper authorization checks are in place before processing object references?
-
Question 5: What are three methods to mitigate IDOR vulnerabilities?
(Choose all that apply.)- A) Use randomized and unpredictable identifiers for objects
- B) Implement role-based access controls
- C) Use parameterized queries to prevent SQL injection
- D) Avoid exposing object references in URLs
- E) Log out users automatically after 5 minutes of inactivity
- Find an IDOR in a Real or Test Environment:
- Set up DVWA or OWASP Juice Shop and attempt to exploit an IDOR vulnerability in the web application.
- Submit a report documenting the following:
- The URL you manipulated to exploit the IDOR
- The data or resource you gained unauthorized access to
- Potential impact if this vulnerability were exploited in a real-world scenario
- How you would fix the vulnerability to prevent future exploitation
-
Question 6: Why are IDOR vulnerabilities so dangerous in applications that handle sensitive data (e.g., financial, medical, personal information)?
-
Question 7: How can an attacker discover which internal object references (like user IDs or file paths) to manipulate when testing for IDOR vulnerabilities?
-
Question 8: Explain how an IDOR vulnerability could lead to privilege escalation in an application.
By completing this lab, students should have a solid understanding of Insecure Direct Object References (IDOR) and their risks. Students will also be equipped with practical knowledge on how to test for these vulnerabilities and implement proper mitigations.