Skip to content

Fix HTML Tampering price broken access control (Challenge-7) - #495

Closed
beanbeah wants to merge 2 commits into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/r2-challenge-challenge-7-html-tampering
Closed

beanbeah wants to merge 2 commits into
OWASP-CTF:dc34-ctffrom
beanbeah:ctf/r2-challenge-challenge-7-html-tampering

Conversation

@beanbeah

@beanbeah beanbeah commented Aug 9, 2026

Copy link
Copy Markdown

Vulnerability

The /HtmlTampering/task endpoint (Challenge-7-HTML-Tampering, A01 Broken Access Control) accepted the Total price value submitted by the client alongside QTY and marked the checkout as solved whenever that client-supplied total was lower than the real price. Since Total is populated from a hidden HTML form field, an attacker can simply edit it before submitting the form to buy the item at any price.

Fix

HtmlTamperingTask now treats the unit price as a private, authoritative server-side constant and recomputes the expected total itself (quantity * UNIT_PRICE), rejecting any request whose client-supplied Total does not match within a small rounding tolerance. Non-numeric QTY/Total and QTY <= 0 are also rejected. This matches the lesson's own mitigation guidance in HtmlTampering_Mitigation.adoc.

Local verification (WSL)

  • Built the module and packaged/booted the app locally.
  • Replayed the original exploit: POST /HtmlTampering/task with QTY=1&Total=1 -> now returns tamper failure (previously returned success).
  • Confirmed the legitimate flow still works: QTY=1&Total=2999.99 and QTY=2&Total=5999.98 both return success.
  • Confirmed a quantity-only tamper (QTY=100&Total=2999.99) is also rejected.

🤖 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>
…client Total

The HtmlTampering task previously accepted whatever 'Total' value the
client submitted alongside 'QTY' and marked the assignment as solved
whenever that submitted total was lower than the real unit price times
quantity - classic client-side price tampering / broken access control,
since the price shown to the user comes from a hidden form field the
client fully controls.

Fix: the server now holds the unit price as a private, authoritative
constant and recomputes the expected total itself (quantity * unit
price), rejecting any request whose client-supplied Total does not
match within a small rounding tolerance. Non-numeric QTY/Total and
QTY <= 0 are also rejected. This follows the lesson's own mitigation
guidance (HtmlTampering_Mitigation.adoc): 'look up the price ... and
calculate the total price again' / 'NEVER TRUST INPUT SENT BY A CLIENT'.

Locally verified in WSL: built + booted the app, replayed the original
exploit (QTY=1, Total=1) which now returns tamper.failure instead of
success, confirmed a legitimate request (QTY=1, Total=2999.99, and
QTY=2, Total=5999.98) still returns tamper.success, and confirmed a
QTY-only tamper (QTY=100, Total=2999.99) is also rejected.
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🏆 WebGoat — CTF Patch Score

░░░░░░░░░░░░░░░░░░░░  1 / 137 pts  (1%)

1 / 69 challenges patched

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

Commit: 488c4b5 · scoring run

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

@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