Skip to content

Disable external entity resolution in XXE Challenge One's XML parser - #261

Open
JBHook wants to merge 2 commits into
OWASP-CTF:dc34-ctffrom
JBHook:fix/xxe1-disable-external-entities
Open

JBHook wants to merge 2 commits into
OWASP-CTF:dc34-ctffrom
JBHook:fix/xxe1-disable-external-entities

Conversation

@JBHook

@JBHook JBHook commented Aug 9, 2026

Copy link
Copy Markdown

Summary

XmlDocumentBuilder.xmlDocBuilder()'s own inline comments document the safe value for each of its 6 feature flags, but the call in readXml() passed the unsafe value for every single one - doctype declarations, external general/parameter entities, external DTD loading, XInclude, and entity expansion were all left fully enabled, allowing classic XXE-based external file disclosure.

Fix

Switched to the documented safe values for all 6 parameters.

Test plan

  • mvn compile, mvn spotless:check clean, full test suite passes
  • Live-validated: legit XML request still works; a DOCTYPE/external-entity payload targeting /etc/passwd now fails to parse instead of resolving the file.

🤖 Generated with Claude Code

XmlDocumentBuilder.xmlDocBuilder()'s own inline comments document the
safe value for each of its 6 feature flags (disallow_doctype_decl
safe=true; the rest safe=false), but the call in readXml() passed the
unsafe value for every single one - doctype declarations, external
general/parameter entities, external DTD loading, XInclude, and
entity expansion were all left fully enabled, allowing classic
XXE-based external file disclosure via a crafted DOCTYPE/entity in
the submitted XML body.

Switched to the documented safe values for all 6 parameters.

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

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🏆 Security Shepherd — CTF Patch Score

░░░░░░░░░░░░░░░░░░░░  0 / 79 pts  (0%)

0 / 40 challenges patched

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

Commit: 351d2ec · 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! 💪

XxeChallenge1OldWebService's identical vulnerable xmlDocBuilder() call was
already fixed, but the XXE lesson page (servlets/module/lesson/XxeLesson.java)
has the exact same unsafe call and was never touched - same classic XXE
file-disclosure exposure via a crafted DOCTYPE/entity in the submitted XML,
just reachable through the lesson endpoint instead of the challenge one.

Switched to the documented safe values for all 6 parameters, matching the
fix already applied to XxeChallenge1OldWebService.
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