GitHub Advisoryadvisory · Packagist

GHSA-j2w7-387v-m2rq PhpSpreadsheet ODS Reader: Unbounded number-rows-repeated → CPU & Memory Exhaustion (DoS)

HIGH Published 2026-10-27 Modified 2026-10-27 Official page ↗
Aliases
CVE-2026-108359
Ecosystem
Packagist
Packages
phpoffice/phpspreadsheet
Severity
High
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Weaknesses
CWE-400, CWE-789
Reviewed
2026-10-27

Affected packages

• Packagist phpoffice/phpspreadsheet: >= 4.0.0, < 5.10.0 → fixed in 5.10.0 • Packagist phpoffice/phpspreadsheet: >= 3.3.0, < 3.10.8 → fixed in 3.10.8 • Packagist phpoffice/phpspreadsheet: >= 2.2.0, < 2.4.8 → fixed in 2.4.8 • Packagist phpoffice/phpspreadsheet: >= 2.0.0, < 2.1.19 → fixed in 2.1.19 • Packagist phpoffice/phpspreadsheet: < 1.30.7 → fixed in 1.30.7

Description

Summary When PhpSpreadsheet loads an OpenDocument Spreadsheet (`.ods`), `Ods::processTableRow()` reads the `table:number-rows-repeated` attribute of a `` 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 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 self::MAX_COLUMN_INT) { 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: `` (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 1 ``` Not vulnerable (for reference - throws exception): ```xml 1 ``` This column-repeat example throws `Column string index can not be beyond XFD` exception (bounded defense, already in place).

Related

Alias · CVE (1)

  • CVE-2026-108359 PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. vulnerability

Weakness · CWE (2)

  • CWE-400 Uncontrolled Resource Consumption weakness
  • CWE-789 Memory Allocation with Excessive Size Value weakness

References