PHPOffice PhpSpreadsheet: XmlScanner bypass allows XXE and DoS (CVE-2026-108358)
An XML parsing bypass in PhpSpreadsheet allows attackers to use ISO-2022 escape sequences to evade security filters, leading to potential DoS via entity expansion or XXE/SSRF depending on configuration.
CVE search metadata
CVE search record: CVE-2026-108358. EPSS: 0.62%. KEV: no. Product: PhpSpreadsheet (<= 1.30.6), PhpSpreadsheet (2.0.0-2.1.18), PhpSpreadsheet (2.2.0-2.4.7), PhpSpreadsheet (3.3.0-3.10.7), PhpSpreadsheet (4.0.0-5.9.0). Brief: PHPOffice PhpSpreadsheet: XmlScanner bypass allows XXE and DoS (CVE-2026-108358). Brief link: https://feed.craftedsignal.io/briefs/2026-11-phpspreadsheet-xxe-bypass/
Triage facts
Revision 1- Applicability
- PhpSpreadsheet (<= 1.30.6), PhpSpreadsheet (2.0.0-2.1.18) +3
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 1 public source
- Freshness
- Revision 1Nov 5, 13:44 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A1Likely
The XmlScanner::scan() method in PhpSpreadsheet utilizes an insufficient regular expression that only handles NULL byte (0x00) interleaving to detect <!DOCTYPE declarations. An attacker can bypass this filter by inserting ISO-2022 escape sequences (0x1B bytes) between the characters of the DOCTYPE tag. Because the XML parser performs charset normalization and strips these bytes before processing, the resulting XML becomes a valid document with an injected DOCTYPE that was never validated. This allows for Denial of Service through quadratic entity expansion on all PHP versions, and XXE or SSRF on systems running PHP < 8.0 or those configured with LIBXML_NOENT.
Attack Chain
- Attacker crafts a malicious XLSX archive file containing a specially encoded XML part (e.g.,
sharedStrings.xml). - Attacker embeds
<!DOCTYPEtags within the XML using ISO-2022 escape sequences (e.g.,ESC ( B) to obfuscate characters. - Attacker uploads the file to the target application using PhpSpreadsheet.
- The application triggers
PhpSpreadsheet\Reader\Security\XmlScanner::scan()on the uploaded file. - The
XmlScannerregex fails to identify the obfuscatedDOCTYPEdue to the presence of escape sequences. - The
SimpleXMLloader processes the XML and performs charset normalization, stripping the escape sequences and revealing theDOCTYPE. - The XML parser processes the
DOCTYPE, leading to entity expansion (DoS) or file/network access (XXE/SSRF).
Impact
Successful exploitation can cause significant resource exhaustion (DoS) via memory-intensive entity expansion. In environments with older PHP versions or specific XML configuration, it facilitates information disclosure and server-side request forgery. A 2 KB malicious XLSX file can result in ~45 MB of peak memory usage.
Recommendation
- Update PhpSpreadsheet to the latest patched version immediately.
- Implement strict file validation for user-uploaded XLSX files to ensure they conform to expected schemas before processing.
- Limit memory_limit for scripts that process user-supplied spreadsheet files to mitigate the impact of quadratic entity expansion.
- Ensure
libxml_disable_entity_loader(true)is explicitly set if using older PHP environments where this is not default.
Immediate actions
Upgrade PhpSpreadsheet to 1.30.7 or later
Threat Hunt
Search application logs for unusual memory usage spikes or timeouts associated with file upload endpoints.
Data: Web server error logs, Application telemetry
Mitigations
Upgrade PhpSpreadsheet to 1.30.7 or later
CVE-2026-108358