Attacks and Exploits

A tester adds "role":"admin" to the JSON body of a PUT /api/users/me request that normally sends only name and email. The account becomes an administrator. Which weakness does this show?

Show the answer

Correct answerA. Mass assignment

AWhy this is right: The API accepts extra fields in the body and writes them to the user record, including role.

BWhy not this: No template expression was submitted or evaluated; the extra JSON field was simply accepted.

CWhy not this: No token claim or signature was altered; the change was made in the request body.

DWhy not this: No identifier was changed to reach another user's record, so this is not an object reference flaw.

Mass assignment occurs when an API binds every field in the request body to the object, so a client can set properties such as role that it should not control. Insecure direct object reference would require changing an identifier to reach another user's data, which did not happen here.