XXE via File Uploads
XXE delivered through files whose formats are XML under the surface — SVG, OOXML documents, PDF/XFA, media metadata — reaching a server-side parser that most testers never associate with “XML input.”
Why uploads are a prime surface
XXE should be tested “whenever XML is parsed, which is probably more common than you think” (How to Find XXE Bugs). Upload endpoints that read a file (import, combine, extract metadata, rasterize, index) feed it to an XML parser, and the insecure behavior is often the parser default. Endpoint names are a tell — CombineExcelUpload “accepts Excel, uploads it, and combines — meaning it reads it” (XXE Hidden in Cell A2). This surface is “often missed” precisely because the payload delivery is obscure (10 Often-Missed Web Vulnerabilities).
OOXML — DOCX / XLSX / PPTX
Office Open XML files are ZIP archives of XML parts: [Content_Types].xml, _rels/.rels, xl/workbook.xml, xl/worksheets/sheet1.xml, etc. Unzip any .docx and the structure is plain. Inject a DOCTYPE + entity into a part the server parses — for XLSX, cell values in sheet1.xml; if the app reflects the cell, you get in-band read. External entity resolution is the default in older .NET XML codebases (10 Often-Missed Web Vulnerabilities, XXE Hidden in Cell A2).
Practical notes:
- The archive must stay structurally valid — all required parts present — or the parser rejects it before reaching your payload. Tools (
oxml_xxe,docem,XXElixir) rebuild valid archives; hand-building a minimal five-file XLSX also works (XXElixir). - Choose a target file with no XML metacharacters for the first proof (Windows
win.ini) so general-entity substitution doesn’t break the outer document. - Hiding the DOCTYPE inside the inner XML slips past WAFs that only inspect the multipart envelope (XXE Hidden in Cell A2).
- PhpSpreadsheet’s
XmlScannerprotection has been bypassed via ISO-2022 escape sequences and double-encoded-entityunentity()TOCTOU, re-enabling XXE/DoS on uploaded XLSX (PhpSpreadsheet ISO-2022 Bypass, PhpSpreadsheet unentity() TOCTOU).
SVG uploads
SVG is XML, so image-upload and avatar endpoints that rasterize or sanitize SVG server-side are XXE sinks (also SSRF/XSS — see SVG and File Upload XSS). A recurring anti-pattern: sanitization coupled to successful image validation. In SnapOtter, a DOCTYPE made the image validator fail, which skipped the sanitizer, storing the malicious markup; the fix sanitizes every SVG-bearing upload regardless of decode success (SnapOtter SVG Upload Bypass). Telerik Reporting’s SVG processor (CVE-2026-118975) allowed authenticated file read / server-side requests via crafted SVG in reports (Telerik Reporting SVG XXE).
PDF / XFA and media metadata
- PDF/XFA: Apache Tika CVE-2025-66516 (CVSS 10.0) parses a malicious XFA form embedded in an uploaded PDF — any service using Tika for document parsing is reachable; mass-scanned, 500+ instances (Apache Tika XXE).
- Media metadata: WordPress CVE-2021-29447 — a low-priv author uploads a crafted WAV whose iXML metadata chunk carries the XXE, giving remote file disclosure (WordPress WAV XXE).
- GPX / Atom / RSS: RunKeeper parsed uploaded GPX (XML) route files — classic early XXE; feed importers parse Atom/RSS the same way (h3xStream RunKeeper).
Document parsers may still be safe-by-config: python-docx 1.2.0 builds its parser with resolve_entities=False, so a DOCX entity is left unresolved there — verify the specific library/version rather than assuming (XXE as a DAST Finding).
Notable cases
- Bol.com — seller portal accepted product XLSX uploads; Jonathan Bouman injected XXE into the spreadsheet to read local files (XXE at Bol.com).
- 247CTF Meme Upload — a crafted PHAR passed image validation, and PHP
DOMDocumentloading aphar://stream via XXE triggered metadata deserialization to RCE (247CTF Phar Meets XXE). - Shopware — authenticated admin extension-package upload leads to XXE file disclosure (Shopware Extension XXE).
- SnapOtter (GHSA-9c7h-xjrp-8gh3): an external-entity DOCTYPE made librsvg reject the SVG, which skipped the sanitizer. The XXE and SSRF vectors failed because librsvg refuses to resolve external entities, but stored XSS worked (SVG and File Upload XSS; advisory).
Related
- XML External Entity Injection
- SVG and File Upload XSS
- Unrestricted File Upload
- Error-Based XXE
- XXE Parser Defaults and Hardening
Sources
- The File That Answered Back — XXE Hidden in Cell A2 · original
- 10 Often-Missed Web Vulnerabilities · original
- Exploiting XXE via File Uploads (SVG, XLSX, DOCX) · original
- SnapOtter: Stored XXE/SSRF/XSS via SVG Upload · original
- Telerik Reporting SVG Processing XXE · original
- WordPress CVE-2021-29447 XXE via WAV · original
- PhpSpreadsheet XmlScanner ISO-2022 Bypass · original
- PhpSpreadsheet unentity() TOCTOU Bypass · original
- XXE at Bol.com · original
- 247CTF Phar Meets XXE · original
- Identifying XXE | h3xStream · original
- XXElixir · original
- Shopware Extension Processing XXE · original
- How to Find XXE Bugs: Severe, Missed, and Misunderstood · original
- Critical Apache Tika Vulnerability Leads to XXE Injection · original
- XXE as a DAST finding: in-band, error-based and out-of-band confirmation · original