GHSA-j2w7-387v-m2rq: Composer/phpoffice/phpspreadsheet vulnerability

Published Oct 27, 2026
·
Updated

Summary

When PhpSpreadsheet loads an OpenDocument Spreadsheet (.ods), Ods::processTableRow() reads the table:number-rows-repeated attribute of a <table:table-row> with an unchecked (int) cast, then materialises one cell per repeated row. This value is completely unbounded, so a single ~1.4 KB file can instruct the reader to create up to millions of cells, exhausting memory (fatal OOM). No authentication, no special configuration, and the default read filter are required - any application that loads a user-supplied .ods is affected.

---

Affected versions

The number-rows-repeated expansion has existed in the ODS reader since its inception (pre-dating the current release branches), so all maintained lines are affected.

| Branch | Affected | |--------|----------| | 1.x | ≤ 1.30.6 | | 2.0–2.1 | ≤ 2.1.18 | | 2.2–2.4 | ≤ 2.4.7 | | 3.x | ≤ 3.10.7 | | 4.x–5.x | ≤ 5.9.0 (latest) |

---

Root cause (source → sink)

src/PhpSpreadsheet/Reader/Ods.php:

php // line 816 — row repeat, unchecked (int) cast $rowRepeats = (int) $childNode->getAttributeNS($tableNs, 'number-rows-repeated'); ... // line 1151 — row materialisation loop: NO upper bound for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) { $rID = $rowID + $rowAdjust; $cell = $spreadsheet->getActiveSheet()->getCell($columnID . $rID); // allocates a Cell $cell->setValueExplicit($dataValue, $type); // ... no bounds check on $rowAdjust or $rID ... }

Why columns are NOT vulnerable (already bounded):

The column-header loop at line 1326 shows the correct pattern with bounds checking:

php // line 1326 (processTableColumnHeader): BOUNDED correctly for ($rowRepeats2 = $rowRepeats; $rowRepeats2 > 0 && $tableColumnIndex2 <= AddressRange::MAXCOLUMNINT; --$rowRepeats2) { // HAS BOUNDS CHECK: && $tableColumnIndex2 <= AddressRange::MAXCOLUMNINT }

Additionally, the cell-data column loop at line 1141 calls getCell() which throws exception at Coordinate.php:448 when column exceeds MAXCOLUMNINT (XFD / 16,384):

php // Coordinate.php line 448 if ($columnIndex > self::MAXCOLUMNINT) { throw new Exception('Column string index can not be beyond XFD'); }

Result: Columns are capped at 16,384. Only rows are unbounded.

---

Impact

Memory exhaustion (single valued cell, repeated many rows): A non-null cell value with a huge number-rows-repeated attribute materialises millions of Cell objects → PHP fatal Allowed memory size ... exhausted.

Example: - Payload: <table:table-row table:number-rows-repeated="5000000"> (5 million rows) - File size: 1.4 KB - Memory consumed: ~256 MB (one Cell object per row) - Result: OOM at default memory limit

---

Reproduction

Vulnerable payload (causes OOM):

xml <table:table table:name="Sheet1"> <table:table-row table:number-rows-repeated="5000000"> <table:table-cell office:value-type="float" office:value="1"> <text:p>1</text:p> </table:table-cell> </table:table-row> </table:table>

Not vulnerable (for reference - throws exception):

xml <table:table table:name="Sheet1"> <table:table-row> <table:table-cell office:value-type="float" office:value="1" table:number-columns-repeated="1000000000"> <text:p>1</text:p> </table:table-cell> </table:table-row> </table:table>

This column-repeat example throws Column string index can not be beyond XFD exception (bounded defense, already in place).

Affected Software

5 affected componentsFixes available
composer/phpoffice/phpspreadsheet<=1.30.6
1.30.7
composer/phpoffice/phpspreadsheet>=2.0.0<=2.1.18
2.1.19
composer/phpoffice/phpspreadsheet>=2.2.0<=2.4.7
2.4.8
composer/phpoffice/phpspreadsheet>=3.3.0<=3.10.7
3.10.8
composer/phpoffice/phpspreadsheet>=4.0.0<=5.9.0
5.10.0

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.7
  2. Upgrade

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

    Fixed in 2.1.19
  3. Upgrade

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

    Fixed in 2.4.8
  4. Upgrade

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

    Fixed in 3.10.8
  5. Upgrade

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

    Fixed in 5.10.0

Event History

Oct 27, 2026
Advisory Published
via GitHub·03:38 PM
Data Sourced
via GitHub·03:38 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed?

Any application using PhpSpreadsheet to load user-supplied .ods files is affected. No authentication or special configuration is required.

2

Does the default reader configuration prevent exploitation?

No. The issue can be triggered with the default read filter, so deployments do not need to have custom ODS reader settings to be exposed.

3

What does an attacker need to provide?

An attacker needs to cause the application to load a crafted ODS file containing a table:number-rows-repeated value. A single approximately 1.4 KB file can request millions of cells and exhaust memory.

4

How can I determine whether my installed version is affected?

Affected versions include 1.x through 1.30.6, 2.0–2.1 through 2.1.18, 2.2–2.4 through 2.4.7, 3.x through 3.10.7, and 4.x–5.x through 5.9.0. The advisory states that the issue has existed since the ODS reader's inception and that 5.9.0, the latest listed release, is affected.

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