Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated
XXE is a technique that abuses XML reading to steal internal files. The name stands for XML external entity. MITRE's CWE-611 organizes it as a weakness in which an XML parser (the component that reads XML) resolves what an external entity points to and so pulls in a document from outside its control.
How does XXE work?
Picture an order form that says "see the attachment for details". A clerk fetches the attachment from the place written and encloses it with the order. If the place is in a field anyone can rewrite, the clerk may enclose papers from a place nobody asked for.
XML also has a way of writing "bring in content from another place here". This is the external entity. If the reading component follows it as written, files inside the server can be pulled in and may appear in the response or an error message.
OWASP's basic policy is to disable DTD (document type declaration) processing wherever possible. When DTDs are needed, disable resolving external entities and loading external DTDs, and limit how much can be expanded. If the component you use does not support the settings that are needed for safety, OWASP advises treating it as a failure instead of carrying on with only partial protection. How to check is gathered on the XXE vulnerability page.
Why does XXE matter?
CWE-611 lists three possible results. The first is reading files inside the server. The second is the application connecting to a server the attacker cannot reach directly. The third is a load problem from making the system read huge data.
The second resembles SSRF. Features that receive XML are all over a business: data linking, form imports and communication with outside systems. A component's default settings are not always safe, so check them when you introduce it.
If the library you use is old, known weaknesses remain. Consider replacing components whose updates have stopped.
For a look at what your own site shows from outside, the free URL check is free and reads only public information.
Related terms
- SSRF: a technique that uses the server as a stepping stone to reach internal devices.
- Path traversal: a technique that reads files from folders that were not made public.
Next step
List the features of your own site that receive XML, and check the settings and update status of the components behind them. How to check and fix it is on the XXE vulnerability page, and preparation against leaks is in information leak measures. To have the settings reviewed, contact us.
Frequently asked questions
Does XXE concern sites that use only JSON?
If no feature reads XML, XXE has no entrance. But a component that handles XML may be in use where you do not notice, such as importing forms or linking with outside systems. List the features you use.
Where do I start with XXE measures?
Find out whether the XML-reading component you use lets you switch off DTD processing. OWASP advises disabling DTDs wherever possible. If you cannot tell, ask the developer or your agency.
Frequently asked questions
Does XXE concern sites that use only JSON?
If no feature reads XML, XXE has no entrance. But a component that handles XML may be in use where you do not notice, such as importing forms or linking with outside systems. List the features you use.
Where do I start with XXE measures?
Find out whether the XML-reading component you use lets you switch off DTD processing. OWASP advises disabling DTDs wherever possible. If you cannot tell, ask the developer or your agency.