Home / Knowledge hub / XXE
Knowledge hub
XXE
An XML parser tricked into fetching files or internal addresses.
What it means
XXE stands for XML external entity. An XML document can carry references telling the parser to go and fetch something else. A parser configured to follow them does so without asking. Those references are entities, and the external kind points at something outside the document.
An attacker points one of those references at a file on your server, or at an internal address, and the parser hands the contents back.
Why it matters
It amounts to reading your server's own filesystem from outside: configuration files, credentials, keys. It doubles as a way to make your server call internal services, which is server-side request forgery wearing a different hat.
Because it arrives inside a file upload or an API payload, it often reaches parts of the system nobody expected outside traffic to touch. Review misses it easily, because the vulnerable code reads like two ordinary lines. Read this document. Parse it.
How much it costs you depends on what the server process can read, which is routinely more than the application itself needs.
How it shows up
Look wherever you accept XML: document uploads, older API endpoints, spreadsheet and office file imports, single sign-on messages, anything speaking an older integration format.
The fix is usually a flag rather than a rewrite. OWASP's advice is to disable document type definitions outright where you can. Defaults vary by language and by version, so do not assume yours is safe, and check the libraries underneath your own code. A parser buried in a dependency can be configured differently from the one you call directly, and it is generally the older one.
Questions people ask
XXE, answered
Is XXE still relevant when everything uses JSON?
Yes, because XML did not leave. It survives in SOAP services, single sign-on messages, office document formats, SVG images and older partner integrations.
Those paths get less attention than the JSON API, which is precisely why the flaw lasts there.
Does my parser disable external entities by default?
Maybe, and that is the trouble. Defaults differ by language, by library and by version, and several libraries have changed theirs more than once.
Set the flags explicitly rather than trusting the default. That way an upgrade or a swapped library cannot quietly reopen it.
How is XXE different from SSRF?
XXE is one way to cause SSRF, not a separate outcome. The entity reference makes your server fetch a URL of the attacker's choosing.
The difference is the entry point. XXE also reads local files directly, which plain SSRF usually cannot.
Can XXE come through a file that is not called .xml?
Yes, and this is the common case. Word and Excel documents are zipped XML. SVG images are XML. So are many configuration and sitemap formats.
Anywhere your application opens one of those, an XML parser is running somewhere underneath.
How do you test for blind XXE, where nothing comes back?
You make the server prove it by reaching outward. Point the entity at an address you control and watch for the request arriving.
If the parser resolves it, you get a connection from the target even though the response body shows nothing at all.
Related
Terms that sit next to this one
Injection
Input that ends up running as a command instead of being read as text.
SSRF
Making your server fetch a URL of the attacker's choosing.
Input validation
Checking that what arrives is the shape and range you expected.
Path traversal
Using a crafted file name to reach files outside the intended folder.
Still accepting XML anywhere?
Injection and configuration are two of the ten classes Cyberlop tests, and it reads your parser settings as well as sending the document. Ask about a 30 day pilot for $199.
Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.