Cybernetics

Diagnostic playbook

API mass assignment on user update (escalate level to admin)

Web / API Security / Mass Assignment

Knowledge identity

Definition and taxonomy

Summary

An update endpoint validates only some fields and then applies any present fields from the client JSON, letting a caller escalate privileges by including a privileged attribute.

Severity rationale

Demonstrated escalating API user id=2 (level 1) to level 0 (admin) by sending an extra level field in a PUT request that only validates the name field. Privilege escalation in the authorized lab; the in-memory data is not persisted.

Aliases

Mass assignment, auto-binding, over-posting

Standards

CWE-915 CAPEC-406 A01:2021-Broken Access Control

CVSS vector

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

1. First Signal

What should make an agent suspicious

Symptoms

Including level in the PUT body changes the returned level; validation only requires name; no authorization check on the id being updated.

Prerequisites

Authorized authenticated session with a low-privileged user target; the endpoint applies arbitrary JSON fields.

2. Recognition Logic

How to recognize this next time

For update endpoints, inspect which fields are validated vs applied. Send extra fields (level, role, admin, is_admin) and check if they take effect.

3. Diagnostic Procedure

Safe checks, in order

  1. Confirm authorized scope. 2. GET the target to note current level. 3. PUT with an extra level field. 4. Confirm the field was applied. 5. Do not persist changes (in-memory lab data only). 6. Record which fields were not validated.

4. Proof

Evidence

DVWA api medium: PUT user/2 with {"name":"morph","level":0} returned {"id":2,"name":"morph","level":0}, elevating to admin.

5. Controls

Negative checks

Validation rejects bodies missing 'name' (control); a plain name-only PUT does not change the level.

6. Avoid Bad Memory

False positives and traps

A reflected field in the response does not mean it was applied; here the level visibly changed from 1 to 0, confirming the assignment.

7. Why It Matters

Impact

Privilege escalation to administrator and unauthorized modification of records, including other users.

8. Why It Happened

Root cause

The update handler applies any present input fields without a server-side allowlist, and it does not enforce object-level authorization.

9. Fix

Remediation and prevention

Bind updates to an explicit allowlist of writable fields on the server. Never derive authorization/roles from client-supplied fields. Enforce ownership checks on the id.

10. Re-test

Verification steps

  1. After fix, send a PUT with level and confirm it is ignored/rejected. 2. Confirm only allowlisted fields change. 3. Regression tests with extra-field payloads.

Reference

Tools and sources

Tools used

curl, docker exec for read-only source review

References

OWASP Mass Assignment; CWE-915

Intelligence

Products and history

Technologies

PHP, REST API, JSON

Affected products / versions

DVWA (Damn Vulnerable Web Application) current master

History

First documented in DVWA api module in the 2026-08 benchmark run.

Exploit knowledge

Variants and references

Attack surface

PUT /vulnerabilities/api/v2/user/{id} endpoint accepting arbitrary JSON fields

Exploit maturity

proof-of-concept

Known variants

Updating role/level/group flags via PUT/PATCH, extra fields in JSON being silently applied, validation covering only a subset of writable attributes

Defensive signatures

Update endpoints that reflect unvalidated extra JSON fields, privilege flags that change when included in the request body

Reproduction commands

curl -s -b $JAR http://127.0.0.1:4280/vulnerabilities/api/v2/user/2 # level 1 curl -s -b $JAR -X PUT -H "Content-Type: application/json" -d '{"name":"morph","level":0}' http://127.0.0.1:4280/vulnerabilities/api/v2/user/2 # level 0 (admin)

Exploit references

No external references stored; all evidence from the authorized local lab.

Case provenance

Linked findings