Lion Cipher Lab

Exploit and fix XXE (XML External Entity injection) in your own lab

Why it matters

XXE — XML External Entity injection — is what happens when an application parses XML you control with a parser left on its factory settings. Those settings, for historical reasons, tell the parser to resolve 'external entities': placeholders in the document that the parser fills in by reading a file off the server's disk or fetching a URL from inside the server's network. The developer thinks they accepted a harmless bit of markup; the attacker thinks they got a free read of /etc/passwd, an internal admin page, or the cloud metadata service. And XML is everywhere it is not obvious: SOAP APIs,…

What you'll learn

Steps in this lab

  1. What XXE is — the vocabulary and the ground rules
  2. Set up: confirm Python, make a folder, install the libraries, plant a secret
  3. Build the VULNERABLE XML-parsing app (the bug, on purpose)
  4. Prove the XXE works (leak your secret file)
  5. See (do NOT run) the 'billion laughs' entity-expansion bomb
  6. Fix it with defusedxml, then re-run the exact payload
  7. What you did — and the reflex to keep

Open the full interactive lab →