← Back to sandbox
Security — Injection Intermediate 4 possible tests

XML External Entities (XXE)

An XML parser with external entity resolution enabled. Supply a DOCTYPE that declares an entity pointing at a local file or internal HTTP endpoint — the parser resolves it and returns the contents in the response.

What is XXE?

XXE occurs when an application parses XML that includes a DOCTYPE declaration defining external entities. If the parser follows SYSTEM references without restriction, an attacker can read local files via file://, trigger server-side requests via http://, or perform denial-of-service via recursive entity expansion. The fix is to disable DOCTYPE processing entirely.

What is hidden here

True Positive Plain XML with no DOCTYPE or entity declarations — parses correctly
Bug Found file:///etc/passwd — unsafe parser resolves the entity and leaks system user accounts
Bug Found http://169.254.169.254/ — SSRF via XXE; parser makes outbound request to cloud metadata endpoint and injects the IAM credentials into the response
True Positive Safe endpoint rejects any DOCTYPE declaration before entity resolution

Endpoint A — Unsafe Parser

This endpoint parses the submitted XML using Python's standard xml.etree.ElementTree with no restrictions on DOCTYPE declarations or external entity resolution. Paste a payload or use a quick-test button.

✗ External entities enabled
Quick tests
entity resolved — file contents

    

Endpoint B — Safe Parser

This endpoint rejects any XML document that contains a DOCTYPE declaration before attempting to parse it. External entity resolution never takes place.

✓ DOCTYPE declarations rejected
Quick tests

  • Use the Valid XML quick-test on Endpoint A — no DOCTYPE, no entities. The parser processes it cleanly and returns the document fields (true positive).
  • Use file:///etc/passwd on Endpoint A — the entity declaration tells the parser to read the local file. Its contents are substituted into the XML output and returned in the response, exposing system user accounts (bug found).
  • Use http:// metadata on Endpoint A — the entity declaration points to the AWS instance metadata endpoint. The server makes the outbound request, retrieves temporary IAM credentials, and injects them into the parsed document (bug found — SSRF via XXE).
  • Repeat any XXE payload on Endpoint B — the DOCTYPE check fires before entity resolution and the request is rejected outright. No file is read and no outbound request is made (true positive).