Skip to content

Fix IDOR alt-path: require exact path match (Challenge-42) - #493

Closed
beanbeah wants to merge 2 commits into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/r2-challenge-challenge-42-idor-own-profile
Closed

beanbeah wants to merge 2 commits into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/r2-challenge-challenge-42-idor-own-profile

Conversation

@beanbeah

@beanbeah beanbeah commented Aug 9, 2026

Copy link
Copy Markdown

Vulnerability

IDORViewOwnProfileAltUrl.completed() (POST /IDOR/profile/alt-path) split the user-supplied url parameter with the default split("/") and only ever inspected indices [0..3], never checking the resulting array's length. Java's default split() also silently drops trailing empty strings, so a value with extra path segments (or a trailing slash) appended after the legitimate own-profile id segment still matched urlParts[0..3] and was accepted as if it were exactly WebGoat/IDOR/profile/{authUserId}.

Fix

Split with a limit of -1 so trailing empty segments are preserved instead of silently dropped, and require the resulting array to be exactly 4 elements long before checking the four expected path segments. Only a value that is EXACTLY WebGoat/IDOR/profile/{authUserId} (no more, no fewer segments) is now accepted.

Verification (local, WSL)

  • Built and booted the app locally.
  • Registered a user, authenticated as tom via POST /IDOR/login.
  • Legitimate flow (url=WebGoat/IDOR/profile/2342384) still succeeds with the correct profile output.
  • Exploit variant with a trailing slash (url=WebGoat/IDOR/profile/2342384/) now fails (previously succeeded).
  • Exploit variant with an extra trailing segment (url=WebGoat/IDOR/profile/2342384/extra) now fails (previously succeeded).
  • Sanity check with a mismatched user id still fails as before.

🤖 Generated with Claude Code

beanbeah and others added 2 commits August 9, 2026 08:37
Every branch built against this base was failing to build/boot in CI
with ExceptionInInitializerError: TypeTag :: UNKNOWN, because lombok
1.18.36 can't reflectively patch JDK 25's javac internals. Baking the
fix into the fork's own dc34-ctf base so every future branch inherits
it automatically instead of needing a manual per-branch cherry-pick.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
IDORViewOwnProfileAltUrl.completed() (POST /IDOR/profile/alt-path) split
the user-supplied 'url' parameter with the default split("/") and only
ever inspected indices [0..3], never checking the resulting array's
length. Java's default split() also silently drops trailing empty
strings, so a value with extra path segments (or a trailing slash)
appended after the legitimate own-profile id segment still matched
urlParts[0..3] and was accepted as if it were exactly
'WebGoat/IDOR/profile/{authUserId}'.

Fix: split with a limit of -1 so trailing empty segments are preserved
instead of silently dropped, and require the resulting array to be
exactly 4 elements long before checking the four expected path
segments. Only a value that is EXACTLY 'WebGoat/IDOR/profile/{authUserId}'
(no more, no fewer segments) is now accepted.

Locally verified in WSL: built + booted the app, registered a user,
authenticated as tom via POST /IDOR/login, confirmed the legitimate
flow (url=WebGoat/IDOR/profile/2342384) still succeeds, and confirmed
both a trailing-slash variant and an extra-segment variant of the
alt-path value are now rejected where they previously succeeded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🏆 WebGoat — CTF Patch Score

░░░░░░░░░░░░░░░░░░░░  0 / 137 pts  (0%)

0 / 69 challenges patched

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

Commit: d700a30 · scoring run

No points yet — this commit didn't solve any challenges, so there's nothing on the leaderboard for it. Patch a vulnerability and push again! 💪

@beanbeah

beanbeah commented Aug 9, 2026

Copy link
Copy Markdown
Author

Closing as part of a full stand-down of this CTF push.

@beanbeah beanbeah closed this Aug 9, 2026
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