Skip to content

Fix: Excessive Data Exposure on GET /users/v1/_debug (Challenge 5) - #71

Closed
beanbeah wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/challenge-5-excessive-data-exposure-debug-endpoint
Closed

beanbeah wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/challenge-5-excessive-data-exposure-debug-endpoint

Conversation

@beanbeah

@beanbeah beanbeah commented Aug 9, 2026

Copy link
Copy Markdown

Vulnerability

API3:2019 Excessive Data Exposure — GET /users/v1/_debug was completely unauthenticated and returned every user's username, email, plaintext password, and admin flag to anyone, regardless of the vuln flag.

Fix

  • api_views/users.py debug(): now validates the caller's bearer token and requires requester.admin to be true, returning 401 for missing/invalid tokens and 403 for authenticated non-admins.
  • openapi_specs/openapi3.yml: declared bearerAuth security requirement on this path (consistent with other protected admin-only routes like delete_user), added 401/403 responses, and removed the password field from the documented response schema.
  • models/user_model.py User.json_debug(): stopped serializing the plaintext password field entirely — even an authorized admin-only dump should never echo raw credentials back over the API.

Testing

Built and ran the app locally in WSL (vulnerable=1, seeded via /createdb):

  • Unauthenticated GET /users/v1/_debug → 401 (previously 200 with full user dump including plaintext passwords).
  • Authenticated as a non-admin user (name1) → 403 "Only Admins may access debug data!".
  • Authenticated as the admin user → 200, returns username/email/admin per user, no password field.
  • Confirmed unrelated legitimate endpoints still work: GET /users/v1 (public basic list) and GET /users/v1/{username} both unaffected.

🤖 Generated with Claude Code

- Require a valid admin bearer token to access the debug endpoint
  (previously unauthenticated, dumping every user's plaintext password
  and admin flag to anyone).
- Enforce auth at both the OpenAPI layer (bearerAuth security
  requirement, matching other protected routes) and inside debug()
  itself (403 for authenticated non-admins).
- Stop serializing the plaintext password field at all in
  User.json_debug(), even for admins - full account dumps should
  never echo raw credentials back over the wire.

Fixes challenge 5 (API3:2019 Excessive Data Exposure).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@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: 15c7068 · 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-5-excessive-data-exposure-debug-endpoint 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