Sovra Recon·Glossary · XXE

XXE (XML External Entity): Definition, Risks, and Protection

By Solan Barlet, co-founder of Sovra Recon
Updated October 29, 2026

In short

An XXE (XML External Entity) vulnerability affects applications that parse XML using a misconfigured parser. The attacker declares an external entity in the document that points to a local file or a URL: the parser fetches it and inserts its content, allowing the attacker to read files from the server, query internal services (SSRF), or overload the application. Protection involves disabling DTDs—or at the very least, external entities—in the parser.

How XXE Works

The XML format allows entities to be defined in a DOCTYPE declaration, including external entities whose values are read from a file or a URL. If the application returns part of the parsed document, an entity pointing to `file:///etc/passwd` will cause that file to appear in the response. When nothing is returned, “blind” variants exfiltrate the data to the attacker’s server.

The attack surface extends beyond visible XML APIs to include SOAP services, SAML authentication, and uploaded files in SVG or DOCX formats (which contain XML). In the 2017 OWASP Top 10, XXE had its own category (A4); since the 2021 edition, it has been classified under the “Security Misconfiguration” category.

What an attacker can do

  • Reading files from the server: configuration files, keys, source code.
  • Cause the server to send requests to the internal network or cloud metadata services (SSRF).
  • Causing a denial-of-service by recursive entity expansion (known as the “billion laughs” attack).

How to Protect Against It

  • Completely disable DTDs in the XML parser; if that is not possible, disable external entities. The configuration depends on the language and library.
  • Opt for a simpler format, such as JSON, when XML is not essential.
  • Keep XML and SOAP libraries up to date.
  • Treat uploaded files (SVG, office documents) as untrusted XML.

Frequently asked questions

Are recent XML parsers protected by default?

This depends on the language and library: some now block external entities by default, while others do not. The only guarantee comes from an explicit configuration, verified through testing.

Sources

Find out where an attacker would get in.

Our AI agents actually attack your scope, fully automated, and hand you the proof of every vulnerability.