The server exposes two user-creation endpoints. One blindly maps all request fields onto the user object - including privileged fields the client should never control. Find which fields slip through and what they unlock.
Mass assignment occurs when a server applies all fields from a user payload
directly to a model without a whitelist. Attackers inject extra fields -
is_admin,
role,
account_balance -
that the API was never meant to expose. The safe endpoint demonstrates
the correct fix: an explicit field whitelist.
| Test 1 | POST /mass-assignment/ with is_admin=true - flag accepted and set on user record (bug) |
| Test 2 | POST with role=admin - role overwritten on unsafe endpoint (bug) |
| Test 3 | POST with account_balance=99999 - balance field accepted (bug) |
| Test 4 | POST to safe endpoint with is_admin=true - extra field ignored (true positive) |
| Test 5 | POST with only name and email - user created correctly (true negative) |
name
and email.
All other fields are silently dropped before the record is created.
is_admin=true to the unsafe endpoint - check if is_admin
appears as true in the returned user record.
is_admin and isAdmin - both are accepted by the unsafe endpoint.
role=superuser alongside normal fields - does the server return the overridden role?
account_balance=-500 - negative values are accepted without validation.
endpoint=safe and confirm each extra field
appears in rejected_fields, not in the user record.
All tests hit POST /qa-sandbox/mass-assignment/ with x-www-form-urlencoded body.
Switch endpoints by including endpoint=unsafe or endpoint=safe in the body.
POST /qa-sandbox/mass-assignment/ Content-Type: application/x-www-form-urlencoded name=attacker&email=x%40x.com&is_admin=true&endpoint=unsafe
POST /qa-sandbox/mass-assignment/ Content-Type: application/x-www-form-urlencoded name=attacker&email=x%40x.com&role=admin&endpoint=unsafe
POST /qa-sandbox/mass-assignment/ Content-Type: application/x-www-form-urlencoded name=attacker&email=x%40x.com&account_balance=99999&endpoint=unsafe
POST /qa-sandbox/mass-assignment/ Content-Type: application/x-www-form-urlencoded name=attacker&email=x%40x.com&is_admin=true&endpoint=safe
{
"status": "bug_found",
"icon": "🎉",
"title": "Bug Found - Mass Assignment Vulnerability",
"user_record": {
"name": "attacker",
"email": "x@x.com",
"role": "user",
"is_admin": true
},
"accepted_fields": ["name", "email", "is_admin", "endpoint"]
}