跳到正文
Skillpedia
安全6.5k · #13959

idor

它能做什么

这项技能是一份排查不安全直接对象引用的操作指南,即直接使用某个项目的 ID,却没有检查所有权。适合审查自己应用或有权测试代码的开发人员和测试人员。

适用场景

  • ✓当开发人员要求智能体检查修改 URL 或请求中的 ID 是否会暴露他人数据时。
  • ✓当智能体审查接受对象 ID 的 REST、GraphQL 或查询字符串接口时。
  • ✓当团队需要一份必须增加所有权检查的接口清单时。

技能链接

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/idor/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/idor/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我检查,在我们的 API 中修改订单号,能否让用户看到别人的发票?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体找出接受对象 ID 的接口,然后针对每个接口回答三个问题:调用者是否已知、对象是否属于该调用者,以及其角色是否被允许。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

IDOR Hunting Playbook

IDOR is the #1 source of bug bounty payouts because it's simple, ubiquitous, and scanners can't find it (authorization is business logic). Every endpoint that takes an object ID is a candidate.

1. Sources

  • URL path segments: /api/users/123/invoices/456
  • Query string: ?user_id=123
  • JSON body fields: {"orderId": 123}
  • Headers used as auth scope: X-Tenant-ID, X-Customer-Id
  • JWT claims that downstream handlers trust: sub, tenant, role
  • WebSocket subscription filters
  • GraphQL arguments (user(id: 123))

2. Audit workflow

Step 1 — enumerate object-handling endpoints

# REST
grep -rE '@(Get|Post|Put|Delete|Patch)Mapping.*\{[a-zA-Z]+Id\}' /workspace/src   # Spring
grep -rE 'router\.(get|post|put|delete)\([^)]*:id' /workspace/src                # Express
grep -rE '@app\.route\([^)]*<[a-z]+:' /workspace/src                             # Flask
grep -rE 'resources?\s+:[a-z]+' /workspace/src                                   # Rails

# GraphQL
grep -rE 'type Query|type Mutation' /workspace/src
grep -rE '\w+\(id: ID' /workspace/src

Step 2 — for each endpoint, answer three questions

  1. Does it check who the caller is? (auth middleware / decorator)
  2. Does it check whether the object belongs to the caller? (ownership check / tenant filter in the query)
  3. Does it check whether the caller's role permits the action? (RBAC / policy engine)

A "no" to question 2 = horizontal IDOR (read/write other users' data). A "no" to question 3 = vertical IDOR (regular user → admin action).

Step 3 — ownership-check grep patterns

# Django: should have .filter(user=request.user) on the queryset
grep -rE 'Model\.objects\.get\(pk=' /workspace/src | grep -v 'user=request\.user'

# Rails: should have current_user.posts.find(params[:id])
grep -rE 'Post\.find\(params\[:id\]\)' /workspace/src

# Spring: should have @PreAuthorize("#id == principal.id")
grep -rE 'findById\(id\)' /workspace/src | xargs -I{} grep -L '@PreAuthorize\|@PostAuthorize'

3. High-yield patterns

GraphQL IDOR via introspection

curl -X POST https://target.com/graphql \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ __schema { types { name fields { name args { name type { name } } } } } }"}'

Any query field that takes an id arg and lacks a custom directive (@auth(requires: OWNER)) is a candidate. Mutations are even higher value — they often forget ownership checks.

JWT claim trust

If the handler pulls user_id from request.user.id but also accepts a user_id query param as override for "admin features", check whether the override path enforces the admin claim. Frequently broken.

Mass assignment via hidden fields

User.objects.create(**request.POST.dict())
# allows POST'ing is_staff=true

4. PoC workflow

Two-account diff:

  1. Create account A, note sessionA cookie and objectA ID.
  2. Create account B, note sessionB cookie and objectB ID.
  3. curl -b sessionA /api/objects/<objectB> — should 403.
  4. If it returns 200 with objectB data → confirmed IDOR.

For vertical escalation:

  1. Normal user cookie sessionU.
  2. Call admin endpoint: curl -b sessionU -X POST /api/admin/users/<victim>/role -d '{"role":"admin"}'.
  3. Watch the response code + subsequent GET /api/users/<victim>.

5. UUID vs integer

Sequential integer IDs make IDOR trivial. UUIDv4 makes it harder but:

  • UUIDs leak in logs, emails, public URLs, support tickets
  • Many apps use UUIDv1 (time-based) which is partially predictable
  • Enumeration through a listing endpoint still works
  • Some APIs accept both UUID and numeric ID (dual primary key)

Always test UUID endpoints — the "it's a UUID so it's safe" assumption is one of the richest hunting grounds.

6. Success signals

  • HTTP 200 where you expected 403/404
  • Response body contains PII/data belonging to the other account
  • Role field changed on victim account
  • Subsequent admin action now permitted for low-priv session

Negative control: same request with your own account's ID. Should return 200 with identical shape. Anything that returns 404 for your own account but 200 for someone else's is a confirmation signal.

7. Default CVSS

Variant Vector Score
Horizontal read (other user PII) AV:N/AC:L/PR:L/UI
常见问题

什么是不安全的直接对象引用?

就是应用使用请求中的 ID 获取某项内容,却没有检查该用户是否有权查看。

这些 ID 通常出现在哪里?

该技能列出 URL 路径、查询字符串、JSON 请求体、请求头、JWT 声明和 GraphQL 参数等位置。

为什么自动扫描器很难发现这类问题?

该技能指出,授权取决于业务规则,因此扫描器往往无法判断访问是否正确。

详情

作者的原始描述

Hunt Insecure Direct Object Reference (CWE-639) — missing authorization checks on object IDs. Covers horizontal vs vertical privilege escalation, UUID vs integer guessing, and GraphQL introspection-driven IDOR discovery.

repo: BitterSecurity/Decepticon

热度

GitHub 星标
6.5k
排名
#13959
许可证
Apache-2.0
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能