Classification
- CWE-915 Improperly Controlled Modification of Dynamically-Determined Object Attributes.
- OWASP API Security Top 10 2023: API3 Broken Object Property Level Authorization (which merged 2019's Mass Assignment and Excessive Data Exposure).
- OWASP Top 10 2021: CWE-915 is mapped to A08 Software and Data Integrity Failures.
How it is found
Compare what the API returns with what it accepts. Response bodies, documentation and JavaScript bundles reveal property names such as role, verified, credit or tenant_id. Add those to create and update requests (registration, profile update, order creation) and check whether they stick. Try nested objects and alternative casing. Pay particular attention to registration, where a new account with an elevated role is a direct privilege escalation.
What counts as proof
Proof is a differential pair. The attack request includes the privileged field and its effect is visible: the response or a subsequent read shows role: admin, or an admin-only endpoint now works. The control request is the identical body without the field and produces a normal account. The difference proves the server accepted the field rather than defaulting to that value.
Remediation
- Bind requests to explicit input types (DTOs) that contain only writable fields.
- Use framework allow-lists (strong parameters, serializer read_only fields) rather than block-lists.
- Set sensitive properties such as role, owner and balance only in server logic.
- Return explicit response types so internal fields are not exposed as hints.
- Add tests that send extra fields and assert they are ignored.
How Pentest-Swarm tests for mass assignment
Mass assignment is one of the classes Pentest-Swarm proves with a differential oracle.
- The exploit agent smuggles privileged fields such as role: admin or is_admin: true into JSON bodies.
- It replays the attack body against the same body with the field removed; a distinctive privileged value reflected in the attack response but not the control is the proof.
- A shipped VAmPI chain demonstrates self-registration as admin end to end.
- Excessive data exposure, the other half of API3, is also among the classes it reports.
Where it falls short
The oracle proves cases where the privileged value is reflected in a response. Mass assignment whose effect only shows later (a field that changes billing, or an owner ID that matters in another workflow) may be missed and is better found with source review or a manual tester. Field names unique to your domain may not be guessed without a specification.
Questions
What is the difference between mass assignment and BOLA?
BOLA is about which objects a user can access. Mass assignment is about which properties of an object a user can set.
Is hiding a field from the UI enough?
No. Attackers send requests directly. The server must ignore or reject fields the caller may not set.
Which frameworks are prone to mass assignment?
Any that bind request data to models automatically, including Rails, Laravel, Django REST Framework, Spring and Express with ORMs, unless fields are restricted.