Course contentsShow
← Security
Lesson 1020 of 3,05221. Web Security - API SecurityFree lesson

Mass Assignment Vulnerabilities in APIs

Manipulating API parameters to modify unintended object properties by exploiting weak input binding.

What You'll Learn

You'll learn how attackers manipulate API parameters to alter object properties that should be off-limits, turning innocent update requests into privilege escalation attacks.

The Core Idea

Mass assignment occurs when an API automatically binds client-supplied data to internal object properties without filtering which fields can be changed. Imagine a user profile update endpoint that accepts JSON like {"email": "new@email.com"}. If the API blindly assigns all submitted fields to the user object, an attacker could send {"email": "new@email.com", "isAdmin": true, "accountBalance": 999999} and potentially grant themselves admin privileges or free credits.

This vulnerability exploits weak input binding — when frameworks automatically map request parameters to database models or business objects without explicitly defining which fields are allowed.

How It Works

APIs often use convenient data-binding features that take request bodies and map them directly to objects:

  1. Client sends: PUT /api/users/123 with body {"name": "Alice", "role": "admin"}
  2. Server blindly assigns all fields to the User object
  3. If role wasn't meant to be user-modifiable, the attacker just escalated privileges

The attacker discovers vulnerable fields through:

  • Analyzing API documentation or GraphQL introspection (lesson 1000)
  • Examining error messages that leak field names
  • Guessing common property names (isAdmin, role, verified, balance)
  • Observing API responses for field hints (lesson 994)

Why It's Dangerous

Mass assignment bypasses intended authorization (lessons 1018-1019) by modifying fields through parameter manipulation rather than exploiting access controls directly. It turns every update endpoint into a potential privilege escalation point.

Key Takeaway: Mass assignment vulnerabilities let attackers modify sensitive object properties by injecting unexpected parameters into API requests — always use explicit whitelists to control which fields clients can update.