Skip to content
Pwnversity
WEB-MASSASSIGNintermediate · 7 min · upd. 2026-10

Mass assignment

OWASP A08:2025CWE-915

Many frameworks automatically bind request fields to an object’s (model’s) properties. If which fields are bindable isn’t filtered, the attacker adds fields they shouldn’t control (role, isAdmin, balance, verified, user_id) and modifies privileged data. It’s the write side of broken access control —and, together with excessive data exposure, forms the API3:2023 BOPLA category of the OWASP API Top 10—. It’s also called autobinding or overposting.

flowchart LR
    A[Attacker] -->|"JSON with extra fields: role=admin"| B["Model binder (binds EVERYTHING)"]
    B -->|"user.update(req.body)"| M[(Model / DB)]
    M -->|"role, balance, owner overwritten"| P["Privilege escalated"]

Privilege escalation (role=admin, isAdmin=true), state manipulation (balance, verification, price, object ownership), and account takeover. The attacker exploits no memory bug: they use the framework’s own binder against the app.

The vulnerable pattern is binding the whole input to the persistent model: user.update(req.body), a model binder mapping all JSON/form fields, or an ORM that accepts a full dictionary. The flaw appears when that binding is not restricted to an allow-list: if the persistent object is filled from the request with no field filtering, any unlisted property becomes writable from outside. Sharing one class for input and persistence makes this easy to get wrong, but it isn’t sufficient on its own — an allow-list, non-public setters or binder restrictions can still block assignment; the risk is the absence of such filtering.

The invariant the attack breaks: only the fields the user may legitimately edit should be bindable; the rest (role, owner, balance) are set by the server.

  • Flat overposting: add top-level fields (role, verified).
  • Nested / relationship binding: {"user":{"role":"admin"}} or account_id to reassign an object’s ownership.
  • Arrays and collections: inject elements into bound lists (permissions, roles).
  • Type juggling: send isAdmin:true (boolean) or "1" vs 1 so a weak binder or validation coerces the value and assigns it anyway.

The goal is to learn which fields exist in the model even if the form doesn’t show them:

  • Accept-vs-return diffing: if a GET of the resource returns role/verified, try sending them in the POST/PUT/PATCH. What the API shows, it often accepts.
  • Specification: OpenAPI/Swagger, documentation, or the source (models, migrations, serializers) if available or leaked.
  • Common names: admin, is_admin, role, roles, status, approved, verified, owner, user_id, account_id, balance, credit, price.
  • Nested level: also try the same keys inside objects ({"user":{...}}).

Legitimate request vs request with injected fields:

POST /api/account HTTP/1.1
Content-Type: application/json
{"name":"joe","email":"a@b.c","password":"x"}
POST /api/account HTTP/1.1
Content-Type: application/json
{"name":"joe","email":"a@b.c","password":"x",
"role":"admin","isAdmin":true,"verified":true,"balance":99999,"owner_id":1}

Confirm impact by reading the resource afterwards: if role changed to admin, it’s confirmed. Reassigning owner_id/account_id often chains with IDOR/BOLA to take over others’ objects.

Each stack has its allow-list mechanism; its absence or misuse is the flaw:

Framework Correct mechanism Vulnerable symptom
Rails params.permit(:a, :b) (strong params) permit! or update(params[:user]) unfiltered; legacy models with no attr_accessible (pre–strong-params)
Spring @InitBinder + setAllowedFields; DTOs @ModelAttribute binding the whole entity
Django / DRF ModelForm Meta.fields; serializer fields fields = '__all__'; Model.objects.create(**request.data)
Laravel $fillable on the model $guarded = [] or Model::unguard()
.NET MVC/Web API [Bind(Include=...)], DTOs direct entity binding (overposting)
  1. Which fields does the resource return that the form doesn’t ask for? → injection candidates.
  2. Send them in the create/update request (flat and nested).
  3. Did a privileged field change? → impact. Did I reassign ownership? → chain with IDOR.
  4. Prove with a minimal PoC (e.g. your user becomes admin), without touching real data.

Burp Suite (add fields and compare responses), arjun/param-miner to discover hidden parameters, and the OpenAPI spec if available.

Escalation to admin, change of an object’s owner (with IDOR), fraud (balance/price, see business logic), and ATO. In APIs it’s among the best-paid flaws for its direct impact.

Requests with unexpected fields for that endpoint; changes of role, state or ownership through routes that shouldn’t allow them; divergence between the declared schema and the received body.

App logs with the received body (sanitized) and the written fields, API-gateway schema validation, and audit of changes to sensitive fields (role, owner, balance).

  1. Allow-list of bindable fields (DTOs, permit, $fillable, [Bind]); never bind the whole object.
  2. Sensitive fields (role, isAdmin, owner, balance) only modifiable by the server or an explicit authorized flow.
  3. Separate the input model (DTO) from the persistence one.
  4. Schema validation (OpenAPI) that rejects unknown properties (additionalProperties: false).

Revert unauthorized changes, fix the binder (allow-list), and audit which accounts changed role, state or ownership.

  • GitHub / Rails (2012) — Egor Homakov added an unexpected field to a request and associated his public key with someone else’s repository (rails/rails), demonstrating commits in others’ names. The canonical case: it changed Rails’ defaults toward strong params.
  • Modern APIs — still frequent in Node/Express, Laravel and Spring that bind the whole body to the model; it recurs in bug-bounty reports as privilege escalation.

Specific CVEs/incidents in NVD (https://nvd.nist.gov/vuln/search) and GitHub Advisories (https://github.com/advisories).

  • Extra fields (role, isAdmin, verified, owner) sent on registration and update.
  • Accepted vs returned fields compared across the API.
  • Nested binding ({"user":{"role":"admin"}}) and ownership reassignment tested.
  • Common privileged field names tried.
  • Privileged-field change confirmed with a minimal PoC (without touching real accounts).