Mass assignment: when a request sets fields it should not
Prevent requests from setting unintended fields by defining which properties each operation may accept and change.
Many web frameworks can bind request parameters straight into program objects, which saves code. OWASP's Mass Assignment Cheat Sheet describes the downside: an attacker can add parameters the developer never intended, creating or overwriting values the code was not meant to expose. We read the whole sheet on 15 November 2026. We did not read the framework documents, CWE-915 or the GitHub blog post it links.
Other names
OWASP lists: mass assignment (Ruby on Rails, NodeJS), autobinding (Spring MVC, ASP.NET MVC) and object injection (PHP).
The example in plain words
An account form sends a user ID, password and email. The server object behind it also has an administrator flag. If the handler binds the whole request to that object, an attacker adds isAdmin=true to the request and the flag is set, though the form never showed it.
When it is exploitable
The sheet says it is exploitable when attacker-controlled input can set or update fields the caller is not authorised to change, such as a role or an account owner. Field names can be guessed or discovered, so source code is not needed. Constructor and setter binding are both possible (it uses Spring as the example), and nested objects need review too. OWASP cites a 2012 GitHub incident where a user could add a public key to any organisation through mass assignment.
What to do
- Prefer dedicated input objects (DTOs) that contain only the fields the caller may edit, rather than binding to domain objects.
- Explicitly allowlist fields when you bind to an object with other properties.
- Do not rely on a blocklist alone. A field added later or overlooked stays bindable. The sheet shows blocklists only because existing apps use them.
- Keep authorization. DTOs and allowlists limit which properties can be written; they do not decide whether this user may change this object. Authorization still has to.
The sheet gives examples for Spring MVC, Mongoose, Laravel and others, and points to documentation for Rails, Django, ASP.NET, Grails, Play and several JSON mappers. We do not reproduce or test them. Look up your framework's current documentation.
Questions for your team
- Which endpoints bind a request straight into a stored object?
- Which fields on those objects are sensitive (role, owner, balance, status)?
- Is there an allowlist or input object for each, including nested objects?
- Do tests send extra fields and check they are ignored or rejected?
Related: authorization and access control basics, input validation basics, REST API security checklist.
Limits
One OWASP page, read in full. It reflects the sheet on the fetch date; framework behaviour changes, so check your framework's documentation. No statistics. The GitHub incident is OWASP's summary and we did not read the original post.
By Omnistu.