01Issue
Overview
Applications often receive several values together when someone creates an account or edits a profile. A framework may automatically copy those request fields into an application object: a collection of related properties, such as a user’s name, email address, and role. This automatic copying is often called binding. It saves code, but the server must decide which properties the current user is allowed to change.
Mass assignment occurs when that copying also lets a user set a property they should not control. Imagine a profile form that allows a person to change their display name. The same user record also contains a role used to decide whether the person is an administrator. If the server accepts an extra role field from the profile request and uses it without the required permission check, the user may change more than their own name. The same problem can affect form fields, JSON requests, and nested objects. OWASP Mass Assignment Cheat Sheet
This is a property-level authorization issue: the user may be allowed to edit a profile, but not every property on it. OWASP includes unauthorized changes to object properties in API3:2023 Broken Object Property Level Authorization. A field being present in a request or response is a clue; a finding depends on whether an unauthorized value is actually saved or used.
Common causes
- The application copies all request fields directly into a database or domain object.
- The same object contains both user-editable properties and properties reserved for administrators or internal processes.
- Create, update, and nested-object handlers do not explicitly define the fields each caller may change.
- The server relies on a hidden form field, disabled button, or undocumented property to prevent a user from submitting it.
- A field is allowed through validation, but the server does not check whether this user may change it for this object and action.
References: OWASP Mass Assignment Cheat Sheet ↗OWASP WSTG: Mass Assignment ↗OWASP API Security Top 10: Broken Object Property Level Authorization ↗
02Examples
The following requests and response are hypothetical. The profile endpoint is intended to let an ordinary user change only displayName. The second request adds role; the example domain and account values are placeholders.
If the second response merely repeats role, inspect the saved record and resulting permissions before reporting a finding. The illustrated denial below is one possible safe response; an application may instead ignore the extra field and keep the stored role unchanged.
Normal profile update
PATCH /api/profile HTTP/1.1
Host: app.example.test
Content-Type: application/json
{"displayName":"Sam"}Modified request
PATCH /api/profile HTTP/1.1
Host: app.example.test
Content-Type: application/json
{"displayName":"Sam","role":"admin"}Illustrative rejection
HTTP/1.1 400 Bad Request
Content-Type: application/json
{"error":"Property is not allowed"}03Impact
A caller must be able to submit or alter a property and reach a handler that accepts it. The property must be outside that caller’s permitted actions, and the application must save the value or use it in a security-relevant decision.
The effect depends on the field and how the application uses it. An unauthorized change to an approval status could bypass a workflow; changing an owner may affect who can access a record; changing a role may increase permissions if the server trusts that role. A privilege escalation claim requires evidence that the new permissions actually took effect. A reflected field, a successful HTTP response, or an error alone does not prove any of these outcomes.
04Testing
Test cases
1. Check whether an added field changes protected state
Capture a normal update for a test account, add one property the account should not control, and re-read the record. If the property controls permissions, verify whether those permissions actually changed.
Example: Compare the original update with one containing a role field. An echoed field or 200 response does not establish that it was saved.
PATCH /api/profile HTTP/1.1
Host: app.example.test
Content-Type: application/json
{"displayName":"Sam","role":"admin"}
2. Check nested properties and supported formats
Add one candidate property inside a nested object and repeat for input formats the endpoint accepts. Compare the saved state with the normal request.
Example: A profile object may contain a server-controlled approval flag. Check the stored value after the update.
PATCH /api/profile HTTP/1.1
Host: app.example.test
Content-Type: application/json
{"profile":{"displayName":"Sam","approved":true}}
3. Compare related routes and roles
Compare create and update endpoints and requests from separate test roles. Check which properties each role is meant to control and whether a protected value is saved or used.
Example: An administrator may legitimately change a field that an ordinary user cannot. Compare behavior with the documented policy.
PATCH /api/v1/profile HTTP/1.1
Host: app.example.test
Authorization: Bearer TEST_ORDINARY_ACCOUNT
Content-Type: application/json
{"displayName":"Sam","role":"admin"}
4. Identify properties that should be protected
Review response fields, API documentation, forms, and requests from different test roles to identify candidate properties. Check the application’s policy before deciding whether a property is restricted.
Example: A response might include an approval status not shown in the edit form. Its presence is a lead, not proof the field can be changed.
5. Find create and update paths
Capture normal requests that create or edit test records and note their formats, fields, and resulting state. Compare registration, profile update, and other paths that handle the same object.
Example: A profile may be created through registration and updated through a separate API. Record both normal requests before comparing their field controls.
6. Confirm the saved result and rule out false positives
After each altered request, read the record again or inspect an authorized view. Check any related permission or workflow after asynchronous processing has finished.
Example: An API may echo a submitted role without saving it. A success status or an echoed value alone does not confirm a protected change.
Testing references: OWASP Mass Assignment Cheat Sheet ↗OWASP WSTG: Mass Assignment ↗OWASP API Security Top 10: Broken Object Property Level Authorization ↗
05Mitigation
Primary fixes: Define a separate input model or schema for each action and explicitly allow only the fields that action needs. Copy validated values into the record deliberately instead of binding the whole request directly to a database object. Apply the same rules to nested properties and each supported input format. Check on the server that the caller may change the specific property on the specific object; an allowlist alone does not replace authorization. OWASP Mass Assignment Cheat Sheet
Additional measures: Keep internal values such as roles, ownership, approval state, and balances under server control unless a separately authorized operation needs to change them. Log rejected or unexpected property changes without recording secrets, and review similar create and update endpoints for the same pattern.
Retest
Repeat the original request and the extra-field, nested-field, format, and role checks. Confirm protected values remain unchanged for an ordinary user, permitted updates still work, and authorized administrative changes continue to follow the intended policy.