Skip to content

Fix Mass Assignment: block client-set admin flag on self-registration - #72

Closed
beanbeah wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/challenge-4-mass-assignment-admin-registration
Closed

beanbeah wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/challenge-4-mass-assignment-admin-registration

Conversation

@beanbeah

@beanbeah beanbeah commented Aug 9, 2026

Copy link
Copy Markdown

Vulnerability

POST /users/v1/register accepted a client-supplied admin boolean in the JSON request body and used it directly when creating the new user, letting any anonymous caller self-register as an administrator (API6:2019 Mass Assignment).

Fix

register_user() in api_views/users.py no longer reads any privilege field from client input. Every newly self-registered account is now created as non-admin, regardless of what extra fields (e.g. admin) are present in the request body.

Verification (local, WSL, vulnerable=1)

  • Seeded DB via GET /createdb.
  • Exploit attempt: POST /users/v1/register with {"username":"evil_admin",...,"admin":true} -> registration succeeds (200) but GET /users/v1/_debug shows the new user with "admin": false — privilege escalation no longer possible.
  • Legitimate flow still works: normal registration (no admin field) succeeds and the new user can log in and receive a valid auth token, same as before the fix.

POST /users/v1/register previously took an 'admin' boolean straight
from the client-supplied JSON body and used it to set the new user's
privilege level, letting any anonymous caller register themselves as
an administrator. New accounts are now always created as non-admin
regardless of any extra 'admin' (or other) field present in the
request body.
@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

🏆 VAmPI — CTF Patch Score

█░░░░░░░░░░░░░░░░░░░  1 / 16 pts  (6%)

1 / 9 challenges patched

Per-challenge detail is withheld — it would reveal the rubric.

Commit: 92ac6c7 · scoring run

🎉 Your result is on the leaderboard — see where you rank! 🏆

@beanbeah

beanbeah commented Aug 9, 2026

Copy link
Copy Markdown
Author

Superseded by consolidated PR #74 (#74), which merges all validated challenge fixes into one branch. Closing this individual PR.

@beanbeah beanbeah closed this Aug 9, 2026
@beanbeah
beanbeah deleted the ctf/challenge-4-mass-assignment-admin-registration branch August 9, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant