Skip to content

Mass Assignment & Parameter Tampering Defense

Prevent mass assignment and over-posting in REST and GraphQL APIs so callers cannot overwrite role, isAdmin, tenantId, or billing fields in models.

By BugSnaps Security Research · 2 min read · Updated

Add BugSnaps as a preferred source on Google(opens in a new tab)

Want more of our security guides? Select BugSnaps and confirm your choice on Google.

Modern web frameworks make it easy to bind an incoming JSON request body directly to an ORM model or database update call. When an endpoint passes the entire parsed request object to the database without filtering which properties a user is allowed to edit, it creates a Mass Assignment (or Broken Object Property Level Authorization) vulnerability.

How mass assignment leads to privilege and billing tampering

Consider a profile update endpoint (`PATCH /api/v1/users/me`) where the frontend form sends `{ "displayName": "Asha", "timezone": "Asia/Kolkata" }`. If the controller passes `req.body` directly into `db.user.update({ data: req.body })`, an attacker can inspect the GET response for `/api/v1/users/me`, spot internal model columns, and include them in the PATCH payload:

  • Role and permission escalation: submitting `{ "role": "admin" }`, `{ "isStaff": true }`, or `{ "permissions": ["*"] }` on a self-service profile or team-member update route.
  • Tenant reassignment: changing `{ "organizationId": "org_target" }` during object creation or update to inject records into another customer's workspace.
  • Billing and quota manipulation: overwriting `{ "plan": "plus", "scanCredits": 999, "paymentVerified": true }` on an order or account settings endpoint.
  • Verification state bypass: setting `{ "emailVerified": true }` or `{ "mfaRequired": false }` during registration or account recovery.

Enforcing explicit input schemas and DTO allowlists

Blocklist filtering (such as deleting `req.body.role` before saving) is fragile because any new privileged column added to the database schema becomes writable by default until someone remembers to update the blocklist.

Instead, define a strict Data Transfer Object (DTO) or input validation schema (using libraries such as Zod, Valibot, Joi, or Pydantic) for each route and role. Explicitly pick only the fields that specific operation is allowed to modify, derive `userId` and `tenantId` exclusively from the verified server session, and use separate read serializers so internal administrative columns are never leaked in public API responses.

Never pass raw request bodies directly into ORM create or update calls; validate and pick an explicit allowlist of editable fields per endpoint.

Run a vulnerability scan on your website.

Verify your domain and use MyPentest to check for supported web and API weaknesses. Review findings and coverage; a clean scan does not rule out every CVE.