Course contentsShow
← Security
Lesson 928 of 3,05219. Web Security - Business Logic VulnerabilitiesFree lesson

Mass Assignment Fundamentals

Understanding how frameworks automatically bind request parameters to object properties and the security implications.

Mass Assignment Fundamentals

What you'll learn: How web frameworks automatically map user input to application objects—and why this convenience can become a major security risk.

What is Mass Assignment?

Mass assignment is a feature in modern web frameworks that automatically binds HTTP request parameters (from forms, JSON, or query strings) directly to object properties or database fields. Instead of manually setting each property, the framework does it for you in one operation.

Think of it like this: Imagine a hotel check-in form where you fill in your name and room preference. Mass assignment is like a clerk who takes your entire form and automatically fills in all fields in the hotel's system—including fields you never saw, like "VIP status" or "discount rate."

How It Works

When you submit a request like:

POST /users/profile
name=Alice&email=alice@example.com&isAdmin=true

Frameworks with mass assignment might automatically update all matching fields on a User object, including isAdmin—even if you never intended users to modify that field.

The Security Problem

Attackers exploit mass assignment by discovering hidden or internal object properties through:

  • Source code review
  • API documentation
  • Trial and error with common field names (role, isAdmin, balance, price)

They then inject these parameters into requests to escalate privileges, modify prices, or bypass business logic.

Common vulnerable fields:

  • isAdmin, role, permissions
  • balance, credits, price
  • verified, approved, active

The Risk

If your application blindly accepts all incoming parameters, users can modify sensitive attributes they should never access—leading to privilege escalation, financial fraud, or data manipulation.

Key Takeaway: Mass assignment vulnerabilities occur when frameworks automatically bind request data to object properties without explicitly controlling which fields are allowed—always whitelist acceptable parameters.