# 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" ([[raw/bugcrowd.com/how-to-find-xxe-bugs-severe-missed-and-misunderstood-4195|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" ([[raw/infosecwriteups.com/the-file-that-answered-back-xxe-hidden-in-cell-a2-10182|XXE Hidden in Cell A2]]). This surface is "often missed" precisely because the payload delivery is obscure ([[raw/labs.detectify.com/10-types-of-web-vulnerabilities-that-are-often-missed-detectify-labs-1514|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 ([[raw/labs.detectify.com/10-types-of-web-vulnerabilities-that-are-often-missed-detectify-labs-1514|10 Often-Missed Web Vulnerabilities]], [[raw/infosecwriteups.com/the-file-that-answered-back-xxe-hidden-in-cell-a2-10182|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 ([[raw/github.com/xxelixir-tool-for-testing-xxe-via-xlsx-file-upload-poisoning-4188|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 ([[raw/infosecwriteups.com/the-file-that-answered-back-xxe-hidden-in-cell-a2-10182|XXE Hidden in Cell A2]]). - PhpSpreadsheet's `XmlScanner` protection has been bypassed via ISO-2022 escape sequences and double-encoded-entity `unentity()` TOCTOU, re-enabling XXE/DoS on uploaded XLSX ([[raw/github.com/phpspreadsheet-xmlscanner-bypass-via-iso-2022-escapes-allows-xxe-12615|PhpSpreadsheet ISO-2022 Bypass]], [[raw/github.com/phpspreadsheet-xmlscanner-bypass-via-double-encoded-unentity-toctou-al-12617|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 ([[raw/xaferima.com/snapotter-stored-xxe-ssrf-xss-via-svg-upload-sanitization-bypass-15628|SnapOtter SVG Upload Bypass]]). Telerik Reporting's SVG processor (CVE-2026-118975) allowed authenticated file read / server-side requests via crafted SVG in reports ([[raw/telerik.com/telerik-reporting-svg-processing-xxe-cve-2026-118975-15329|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 ([[raw/securityweek.com/critical-apache-tika-vulnerability-leads-to-xxe-injection-4771|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 ([[raw/medium.com/wordpress-cve-2021-29447-exploiting-xxe-to-achieve-remote-file-disclos-14358|WordPress WAV XXE]]). - **GPX / Atom / RSS:** RunKeeper parsed uploaded GPX (XML) route files — classic early XXE; feed importers parse Atom/RSS the same way ([[raw/blog.h3xstream.com/h3xstream-s-blog-identifying-xml-external-entity-vulnerability-xxe-448|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 ([[raw/dedsecops.com/xxe-as-a-dast-finding-in-band-error-based-and-out-of-band-confirmation-14210|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 ([[raw/medium.com/xxe-at-bol-com-jonathan-bouman-medium-463|XXE at Bol.com]]). - **247CTF Meme Upload** — a crafted PHAR passed image validation, and PHP `DOMDocument` loading a `phar://` stream via XXE triggered metadata deserialization to RCE ([[raw/frankhacks.blogspot.com/247ctf-meme-upload-service-hand-built-phar-meets-xxe-14787|247CTF Phar Meets XXE]]). - **Shopware** — authenticated admin extension-package upload leads to XXE file disclosure ([[raw/github.com/shopware-xml-external-entity-injection-in-extension-processing-15637|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]]; [[raw/xaferima.com/snapotter-stored-xxe-ssrf-xss-via-svg-upload-sanitization-bypass-15628|advisory]]). ## Related - [[XML External Entity Injection]] - [[SVG and File Upload XSS]] - [[Unrestricted File Upload]] - [[Error-Based XXE]] - [[XXE Parser Defaults and Hardening]] ## Sources - [[raw/infosecwriteups.com/the-file-that-answered-back-xxe-hidden-in-cell-a2-10182|The File That Answered Back — XXE Hidden in Cell A2]] - [[raw/labs.detectify.com/10-types-of-web-vulnerabilities-that-are-often-missed-detectify-labs-1514|10 Often-Missed Web Vulnerabilities]] - [[raw/exploit-db.com/exploiting-xxe-via-file-uploads-svg-xlsx-docx-4189|Exploiting XXE via File Uploads (SVG, XLSX, DOCX)]] - [[raw/xaferima.com/snapotter-stored-xxe-ssrf-xss-via-svg-upload-sanitization-bypass-15628|SnapOtter: Stored XXE/SSRF/XSS via SVG Upload]] - [[raw/telerik.com/telerik-reporting-svg-processing-xxe-cve-2026-118975-15329|Telerik Reporting SVG Processing XXE]] - [[raw/medium.com/wordpress-cve-2021-29447-exploiting-xxe-to-achieve-remote-file-disclos-14358|WordPress CVE-2021-29447 XXE via WAV]] - [[raw/github.com/phpspreadsheet-xmlscanner-bypass-via-iso-2022-escapes-allows-xxe-12615|PhpSpreadsheet XmlScanner ISO-2022 Bypass]] - [[raw/github.com/phpspreadsheet-xmlscanner-bypass-via-double-encoded-unentity-toctou-al-12617|PhpSpreadsheet unentity() TOCTOU Bypass]] - [[raw/medium.com/xxe-at-bol-com-jonathan-bouman-medium-463|XXE at Bol.com]] - [[raw/frankhacks.blogspot.com/247ctf-meme-upload-service-hand-built-phar-meets-xxe-14787|247CTF Phar Meets XXE]] - [[raw/blog.h3xstream.com/h3xstream-s-blog-identifying-xml-external-entity-vulnerability-xxe-448|Identifying XXE | h3xStream]] - [[raw/github.com/xxelixir-tool-for-testing-xxe-via-xlsx-file-upload-poisoning-4188|XXElixir]] - [[raw/github.com/shopware-xml-external-entity-injection-in-extension-processing-15637|Shopware Extension Processing XXE]] - [[raw/bugcrowd.com/how-to-find-xxe-bugs-severe-missed-and-misunderstood-4195|How to Find XXE Bugs: Severe, Missed, and Misunderstood]] - [[raw/securityweek.com/critical-apache-tika-vulnerability-leads-to-xxe-injection-4771|Critical Apache Tika Vulnerability Leads to XXE Injection]] - [[raw/dedsecops.com/xxe-as-a-dast-finding-in-band-error-based-and-out-of-band-confirmation-14210|XXE as a DAST finding: in-band, error-based and out-of-band confirmation]]