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-09-01. Synthesized from 85 of 85 curated resources. Browse all 85 XXE resources →

Understanding XML External Entity (XXE) Injection

XML External Entity (XXE) injection is a critical web security vulnerability that arises when an application parses XML input containing references to external entities. These external entities, when improperly handled by an XML parser, can be manipulated by an attacker to access sensitive files, perform server-side request forgery (SSRF), cause denial of service, and in some advanced scenarios, achieve remote code execution (RCE) [1][2][3]. The persistence of XXE vulnerabilities, despite being a well-documented threat for over a decade, underscores the ongoing challenge of securing XML processing in modern applications [1].

The core of the XXE vulnerability lies in the XML specification's entity system, which allows for the definition of reusable data units. External entities, in particular, can reference URIs (Uniform Resource Identifiers) that point to local files or remote URLs. When an XML parser, configured with insecure defaults or specific features enabled, processes such an entity, it dereferences the URI and includes the fetched content within the XML document [2][3]. This mechanism, when weaponized, allows attackers to coerce the application into accessing resources that should not be publicly or even internally accessible.

The OWASP Top 10 has consistently featured XXE, highlighting its significant impact and prevalence [4][5][6][7]. The vulnerability is not confined to explicit XML endpoints; it can lurk within file upload functionalities that process XML-based formats like DOCX, XLSX, ODT, or SVG, as well as in SOAP services and other applications that parse XML data, even when not immediately apparent [8][9][10][11][12][13].

Core Mechanics of XXE Exploitation

At its heart, an XXE attack leverages the XML parser's ability to resolve external entities. The fundamental components involved are the XML document itself and a Document Type Definition (DTD), which can be embedded within the XML or provided as a separate external resource.

Entities and DTDs

An entity in XML acts as a placeholder for content. When an external entity is declared, it typically uses the SYSTEM keyword followed by a URI that specifies the location of the external resource. The XML parser, when encountering a reference to this entity, will attempt to fetch and substitute the content from the specified URI.

A basic XXE payload often looks like this:

<?xml version="1.0" encoding="UTF-8"?>

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

In this example, the DTD declares an entity named xxe that points to the local file /etc/passwd. When the parser processes the &xxe; reference within the data element, it attempts to read the contents of /etc/passwd and embed them into the XML output [1][14][3][15][6].

In-Band vs. Out-of-Band (OOB) Exploitation

XXE attacks can be broadly categorized into two types based on how the attacker receives the exfiltrated data:

Error-Based XXE

Another technique, particularly useful in blind XXE scenarios, is error-based exfiltration. Here, the attacker crafts a payload designed to trigger a parser error that inadvertently includes sensitive data in the error message. This relies on the application's error handling to leak information [18][19].

Exploiting Different Protocols

Beyond the common file:// protocol, XXE can exploit other URI schemes depending on the parser's capabilities. Protocols like http://, ftp://, gopher://, and even jar:// or ldap:// can be used for data exfiltration or interaction with internal systems [22][23][24][20][25][26]. The availability and security of these protocols can vary significantly between Java versions, for instance, with older Java versions being more permissive [20][25].

Notable Techniques and Attack Vectors

XXE exploitation techniques have evolved to overcome various security controls and bypass limitations, making it a versatile attack vector.

File Disclosure Attacks

The most common objective is to read sensitive files from the server's filesystem. Attackers typically target:

When direct file access via file:// is blocked, PHP filter wrappers such as php://filter/convert.base64-encode/resource=... can be used to encode file contents, bypassing character restrictions and enabling exfiltration [14][32][15].

Server-Side Request Forgery (SSRF)

XXE can be used as a vector for SSRF, forcing the vulnerable server to initiate requests to internal or external resources. This allows attackers to:

The ArubaOS example demonstrates how XXE could be used to scan internal ports by observing the server's responses to probes against various localhost ports [33].

Exploiting File Uploads

Applications that accept file uploads and parse them server-side are prime targets. By crafting malicious XML-based documents, attackers can trigger XXE:

Blind XXE and Out-of-Band Exfiltration

When direct data reflection is not possible, blind XXE techniques become crucial. These rely on external interactions:

Resource Exhaustion (Billion Laughs Attack)

This attack exploits recursive entity expansion within the XML parser to consume excessive memory, potentially leading to a Denial of Service (DoS). While often mitigated in modern parsers, it remains a theoretical concern [1][40][2][3][15].

Remote Code Execution (RCE)

In specific configurations, particularly with PHP applications that have the expect:// wrapper enabled, XXE can be escalated to RCE. This allows attackers to execute arbitrary system commands by referencing the wrapper within an external entity [14][3][15][26].

Detection and Prevention

Preventing XXE vulnerabilities requires a multi-layered approach, focusing on secure XML parsing configurations and input validation.

Secure XML Parser Configuration

The most effective mitigation is to disable features that allow external entity resolution. This typically involves:

Input Validation and Sanitization

While not a primary defense against XXE, robust input validation can act as a supplementary control. This includes:

Web Application Firewalls (WAFs)

WAFs can be configured with custom rules to detect and block common XXE patterns, such as <!DOCTYPE or SYSTEM keywords within XML payloads. While useful as a defense-in-depth measure, WAFs are not foolproof and can be bypassed by sophisticated attackers [2][42][15].

Dependency Management

Ensuring that all XML parsing libraries and dependencies are up-to-date is critical, as older versions may have insecure defaults or unpatched vulnerabilities. The Apache Tika vulnerability CVE-2025-66516 serves as an example where an incomplete patch left systems vulnerable [43][44].

Tooling for XXE Identification and Exploitation

A variety of tools assist in identifying and exploiting XXE vulnerabilities, streamlining the process for security professionals.

Recent Developments and Notable Vulnerabilities

XXE remains a relevant threat, with new vulnerabilities being disclosed regularly across various software and platforms:

The prevalence of these disclosures underscores the continuous need for vigilance and secure coding practices in handling XML data.

Where to Go Deeper

To further deepen your understanding and practical skills regarding XXE vulnerabilities, consider exploring the following resources:

Continuous learning and practical application are key to mastering the nuances of XXE exploitation and defense.

Sources cited in this guide

  1. XXE Vulnerability Guide 2025: How XML Attacks Still Threaten — instatunnel.my
  2. XXE Complete Guide: Impact, Examples, and Prevention — hackerone.com
  3. XML External Entity (XXE) Processing | OWASP — owasp.org
  4. A Deep Dive Into XXE Injection (Synack) — synack.com
  5. XXE - XEE - XML External Entity - HackTricks — book.hacktricks.xyz
  6. https://portswigger.net/web-security/xxe — portswigger.net
  7. XXE : From Zero to Hero — medium.com
  8. The File That Answered Back — XXE Hidden in Cell A2 — infosecwriteups.com
  9. Exploiting XXE via File Uploads (SVG, XLSX, DOCX) — exploit-db.com
  10. XML External Entity: The Ultimate Bug Bounty Guide to XXE | YesWeHack — yeswehack.com
  11. 10 Types of Web Vulnerabilities that are Often Missed - Detectify Labs — labs.detectify.com
  12. XXE attacks 😈 — link.medium.com
  13. BuffaloWill/oxml_xxe: A tool for embedding XXE/XML exploits into different — github.com
  14. Advanced XXE Exploitation: File Disclosure, Blind OOB, and RCE — github.com
  15. XML External Entity (XXE) Attack Guide | Hackviser — hackviser.com
  16. Blind XXE Attacks: Out of Band Interaction Techniques to Exfiltrate Data — shreyapohekar.com
  17. Out-of-Band XML External Entity (OOB XXE) — invicti.com
  18. Blind XXE: Exfiltrating Data Out-of-Band in 2025 — instatunnel.my
  19. What is a Blind XXE Attack? | PortSwigger — portswigger.net
  20. XXE - Things Are Getting Out of Band — blog.zsec.uk
  21. Hunting in the Dark - Blind XXE — blog.zsec.uk
  22. Rapid7 Analysis: CVE-2022-28219 — rapid7.com
  23. XXElixir: Tool for Testing XXE via XLSX File Upload Poisoning — github.com
  24. XXE-OOB-Exfiltrator: Multi-line Content Exfiltration via External DTD — github.com
  25. h3xStream's blog: Identifying Xml eXternal Entity vulnerability (XXE) — blog.h3xstream.com
  26. XXExploiter — github.com
  27. CVE-2025-30220: GeoServer WFS Service XML External Entity — miggo.io
  28. CVE-2025-27136: LocalS3 CreateBucketConfiguration XXE Injection — offsec.com
  29. CVE-2025-54254: Adobe Experience Manager Forms XXE Vulnerability — sentinelone.com
  30. https://gosecure.github.io/xxe-workshop/#0 — gosecure.github.io
  31. Exploiting XXE for SSRF. Retrieving IAM credentials of EC2… | by Gupta Bles — medium.com
  32. Comprehensive Guide to XXE Exploitation: Advanced Data Exfiltration and RCE — nullsecurityx.codes
  33. 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
  34. https://www.hahwul.com/2019/09/28/oxml-xxe-payload-inject-tool-docem/ — hahwul.com
  35. GitHub - whitel1st/docem: A tool to embed XXE and XSS payloads in docx, odt, pptx, xlsx files (oxml_xxe on steroids) — github.com
  36. Exploiting Blind XXE: Data Exfiltration Through External DTD — medium.com
  37. Blind XXE Lab: Exfiltrate Data Using Malicious External DTD — portswigger.net
  38. https://www.noob.ninja/2019/12/spilling-local-files-via-xxe-when-http.html — noob.ninja
  39. From blind XXE to root-level file read access – Honoki — honoki.net
  40. XXE Injection: Advanced Exploitation Guide — intigriti.com
  41. XML External Entity Prevention · OWASP Cheat Sheet Series — cheatsheetseries.owasp.org
  42. CVE-2025-11035: Jinher OA XXE Vulnerability — sentinelone.com
  43. Critical Apache Tika Vulnerability Leads to XXE Injection — securityweek.com
  44. Critical Apache Tika CVE-2025-66516: XXE Vulnerability — rescana.com
  45. https://www.hackingarticles.in/burp-suite-for-pentester-hackbar/ — hackingarticles.in
  46. How to Protect Text Input from XML External Entity (XXE) Attacks using Pyth — cloudmersive.medium.com
  47. Exploiting Out-Of-Band XXE on Wildfire — dhiyaneshgeek.github.io
  48. Tool for automatic exploitation of XXE vulnerability using direct and diffe — github.com
  49. If you find powerful OXML XXE tool? it’s “DOCEM” — hahwul.com
  50. XXE in GeoServer WFS Service (CVE-2025-30220) — kudelskisecurity.com
  51. CVE-2025-49493: XXE in Akamai CloudTest — xbow.com
  52. IBM Business Automation Workflow XXE (CVE-2025-13096) — ibm.com
  53. XXE Injection in langchain-community (CVE-2025-6984) — security.snyk.io
  54. PortSwigger Blind XXE Lab Write-up — halleffect.medium.com
  55. Hacking Millions of Modems (and Investigating Who Hacked My Modem) — samcurry.net
  56. XXE : From Zero to Hero — infosecwriteups.com
  57. XXE - Things Are Getting Out of Band — blog.zsec.uk
  58. Advice From A Researcher: Hunting XXE For Fun and Profit — blog.bugcrowd.com
  59. Cracked it! Highlights from KringleCon 5: Golden Rings — welivesecurity.com
  60. https://www.slideshare.net/ssuserf09cba/xxe-how-to-become-a-jedi — slideshare.net
  61. 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.