Insecure Direct Object References (IDOR)
π― Authorization Bypass: Accessing data that should not be accessible by manipulating object references
Overview
IDOR is among the most common web vulnerabilities that can lead to accessing data that should not be accessible by attackers. The vulnerability occurs due to the lack of a solid access control system on the back-end, where applications use sequential numbers or user IDs to identify items without proper authorization checks.
IDOR Types:
Static File IDOR - Direct file access with predictable names
Parameter-based IDOR - URL parameters with object references
Encoded/Hashed IDOR - Obfuscated but reversible references
Function-based IDOR - AJAX calls and API endpoints
1. Identifying IDORs
URL Parameters & APIs
Look for Direct Object References in:
URL parameters:
?uid=1,?filename=file_1.pdf,?id=123API endpoints:
/api/users/1,/api/documents/456HTTP headers: Cookies, custom headers with IDs
JSON/XML data: User IDs, file references, resource identifiers
Basic Testing Methodology
Step 1: Identify Object References
Step 2: Test Incremental Values
Step 3: Automated Fuzzing
AJAX Calls Discovery
JavaScript Source Code Analysis:
Browser DevTools Discovery:
Sources Tab - Search for
.ajax(,fetch(,XMLHttpRequestNetwork Tab - Monitor all API calls during usage
Console Tab - List available JavaScript functions
Understanding Hashing/Encoding
Base64 Encoded References
MD5 Hashed References
JavaScript Hash Calculation
Compare User Roles
Multi-User Testing Strategy:
Register multiple test accounts with different privilege levels
Monitor API calls for each user role
Compare object references and access patterns
Test cross-user access with discovered parameters
Example API Call Analysis:
2. Mass IDOR Enumeration
Attack Scenario: Employee Manager
Application Setup:
Insecure Parameters Exploitation
Static File IDOR
Predictable File Naming:
Manual Testing:
Parameter-Based IDOR
URL Parameter Manipulation:
Key Indicators:
Different file links in HTML source
Changed file names/dates in responses
Access to unauthorized data
Mass Enumeration Techniques
Method 1: Bash Script Automation
Method 2: Burp Suite Intruder
Setup:
Send request to Intruder:
GET /documents.php?uid=1Set payload position on UID value:
?uid=Β§1Β§Payload type: Numbers (1-100)
Start attack and analyze responses
Method 3: Python Script
3. Bypassing Encoded References
Function Disclosure Attack
JavaScript Function Analysis
Vulnerable Frontend Code:
Hash Calculation Process:
Input:
uid = "1"Base64 Encode:
btoa("1")="MQ=="MD5 Hash:
CryptoJS.MD5("MQ==")="cdd96d3cc73d1dbdaffa03cc6cd7339b"
Reverse Engineering Process
Mass Contract Enumeration
Hash Calculation for Multiple Users
Automated Download Script
4. IDOR in Insecure APIs
Function Calls vs Information Disclosure
Two IDOR Attack Types:
Information Disclosure - Read files/data belonging to other users
Insecure Function Calls - Execute API functions as other users
API IDOR Capabilities:
Change other users' private information
Reset other users' passwords
Buy items using other users' payment information
Privilege escalation through role manipulation
User account takeover
Attack Scenario: Profile API Exploitation
Application Structure:
Identifying Insecure APIs
API Request Analysis
Original Profile Update Request:
Vulnerable Parameter Discovery
Hidden JSON Parameters:
uid- User identifier (potential target change)uuid- User unique identifier (access control check)role- Privilege level (privilege escalation target)Client-side access control via
Cookie: role=employee
Exploitation Techniques
Attack 1: User Account Takeover
Attempt to change UID:
Response: uid mismatch - API validates UID against endpoint
Attack 2: Cross-User Data Modification
Attempt to modify other user's details:
Response: uuid mismatch - API validates UUID ownership
Attack 3: User Creation (Admin Privilege Required)
Attempt to create new user:
Response: Creating new employees is for admins only
Attack 4: Privilege Escalation
Attempt role elevation:
Response: Invalid role - Unknown role name
Information Disclosure for API Exploitation
GET Request IDOR Testing
Enumerate user details via GET:
Exploitation Chain Strategy
Multi-step IDOR Attack:
Information Disclosure - GET other users'
uuidvaluesFunction Call Exploitation - Use discovered
uuidto modify their dataPrivilege Escalation - Discover valid admin role names
Account Takeover - Complete compromise
Advanced API IDOR Techniques
Method 1: Batch User Enumeration
Method 2: Role Enumeration
Method 3: Cross-User Exploitation
Burp Suite API Testing
Intruder Setup for User Enumeration
Request Template:
Payload Configuration:
Payload type: Numbers
Range: 1-100
Filter responses by status code and content length
Repeater for Parameter Testing
JSON Parameter Fuzzing:
HTB Academy Lab Solutions
Lab 1: Mass Document Enumeration
Target: http://94.237.60.55:37765
Objective: Find flag in documents from first 20 users
Solution:
π― Flag: HTB{...}
Lab 2: Encoded Contract Bypass
Target: http://94.237.54.192:58374
Objective: Download contracts from first 20 employees using hash bypass
Solution Method 1: Calculate contract parameter
Solution Method 2: Calculate filename directly
π― Flag: HTB{...}
Lab 3: API Information Disclosure
Target: http://94.237.54.192:58374
Objective: Read details of user with uid=5 and find their uuid value
Solution:
Expected Response:
Automated UUID Extraction:
Advanced IDOR Techniques
API Parameter Discovery
Hidden Parameter Testing:
UUID and GUID Bypass
Predictable UUID Patterns:
Session-Based IDOR
Cookie Manipulation:
Vulnerable Code Examples
PHP - Insecure Direct Access
Secure Implementation
API - Insecure Access Control
API - Secure Implementation
Prevention & Hardening
Access Control Implementation
Rule-Based Access Control:
Indirect Object References
Secure Object Reference Design:
Detection & Monitoring
Log Analysis
Security Testing Checklist
IDOR vulnerabilities highlight the critical importance of proper authorization checks and secure access control design in web applications.
Last updated