Mass Assignment and Over-Posting
Binding an arbitrary request object onto a model lets the caller edit fields the UI never exposed, including roles, owners and prices.
Frame the problem
Security starts with a concrete asset, attacker capability and trust crossing.
Why the system fails
A generic object merge copies every submitted property rather than selecting the fields this operation is allowed to change.
The important question is not “what is Mass Assignment and Over-Posting?” but “which assumption let untrusted data or an over-scoped identity cross request object → persistent model?” Trace the decision at the boundary, then constrain what can happen after the first control fails.
Design the control in layers
Start with the control closest to the interpretation or privilege boundary: Define an operation-specific allowlist or DTO Then add a control that reduces blast radius and telemetry that proves the decision was enforced.
The resulting design is not labelled secure. Record the identified controls, the known failure paths, the remaining exposure, and the evidence you would need during an incident.
| Prevent | Detect | Recover |
|---|---|---|
| Define an operation-specific allowlist or DTO · Take owner, role and tenant from trusted server state · Authorize sensitive field transitions explicitly | Log attempts to submit unknown or protected fields | Contain the affected identity or component, scope impact from audit evidence, and preserve a regression test. |
Key points
- Asset: Server-controlled fields and privilege-bearing attributes.
- Boundary: Request object → persistent model
- Primary control: Define an operation-specific allowlist or DTO
- Detection signal: Log attempts to submit unknown or protected fields
- Always ask what limits damage when the primary control fails.
Boundary control exercise
This lesson uses the shared boundary-control exercise.
Follow the attack
Safe conceptual simulation: capability → missing control → crossed boundary → asset impact.
- 1Attacker starts with: An authenticated client that can add fields to a request.
- 2A generic object merge copies every submitted property rather than selecting the fields this operation is allowed to change.
- 3The weak or missing boundary control is crossed: Request object → persistent model
- 4Impact: Privilege escalation, ownership changes or integrity loss.
- Privilege escalation, ownership changes or integrity loss.
Defend, detect, recover
One prevention is a single point of security failure. Layer it and make failure observable.
- • Define an operation-specific allowlist or DTO
- • Take owner, role and tenant from trusted server state
- • Authorize sensitive field transitions explicitly
- • Log attempts to submit unknown or protected fields
- • Contain the affected identity or component.
- • Scope access from audit evidence.
- • Fix the boundary and add a regression test.
- • Misconfiguration and new access paths can bypass the intended control.
- • A privileged insider or compromised control plane may still reach the asset.