GHSA-j2w7-387v-m2rq CVE-2026-108359
PhpSpreadsheet ODS Reader: Unbounded number-rows-repeated → CPU & Memory Exhaustion (DoS)
- Severity
- 0.0 / 10
- High · CVSS 4.0
- Exploit chance (EPSS)
- 0.66%
- Chance of exploitation in the next 30 days. Higher than 51.56% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-400 Uncontrolled Resource Consumption
- CWE-789 Memory Allocation with Excessive Size Value
- Fix
5.10.0- Upgrade phpoffice/phpspreadsheet to this version or later
Description
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:
// 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:
// line 1326 (processTableColumnHeader): BOUNDED correctly
for ($rowRepeats2 = $rowRepeats; $rowRepeats2 > 0 && $tableColumnIndex2 <= AddressRange::MAX_COLUMN_INT; --$rowRepeats2) {
// HAS BOUNDS CHECK: && $tableColumnIndex2 <= AddressRange::MAX_COLUMN_INT
}
Additionally, the cell-data column loop at line 1141 calls getCell() which throws exception
at Coordinate.php:448 when column exceeds MAX_COLUMN_INT (XFD / 16,384):
// Coordinate.php line 448
if ($columnIndex > 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:
<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):
<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):
<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 versions
Packagist
| Package | Vulnerable | Fixed in |
|---|---|---|
| phpoffice/phpspreadsheet | >= 4.0.0, < 5.10.0 |
5.10.0 |
| phpoffice/phpspreadsheet | >= 3.3.0, < 3.10.8 |
3.10.8 |
| phpoffice/phpspreadsheet | >= 2.2.0, < 2.4.8 |
2.4.8 |
| phpoffice/phpspreadsheet | >= 2.0.0, < 2.1.19 |
2.1.19 |
| phpoffice/phpspreadsheet | < 1.30.7 |
1.30.7 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
phpoffice/phpspreadsheet Packagist → 5.10.0
- composer
composer require phpoffice/phpspreadsheet:^5.10.0
Severity breakdown
CVSS 4.0 0.0
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
- Attack vector
- Network
- Attack complexity
- Low
- Attack requirements
- None
- Privileges required
- None
- User interaction
- None
- Confidentiality (vulnerable system)
- None
- Integrity (vulnerable system)
- None
- Availability (vulnerable system)
- High
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
Weakness
CWE-400: Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource.
How to prevent it
- Architecture and Design: Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
- Architecture and Design: Mitigation of resource exhaustion attacks requires that the target system either: recognizes the attack and denies that user further access for a given amount of time, or uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed. The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question. The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
- Architecture and Design: Ensure that protocols have specific limits of scale placed on them.
- Implementation: Ensure that all failures in resource allocation place the system into a safe posture.
CWE-789: Memory Allocation with Excessive Size Value
The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.
How to prevent it
- Implementation, Architecture and Design: Perform adequate input validation against any value that influences the amount of memory that is allocated. Define an appropriate strategy for handling requests that exceed the limit, and consider supporting a configuration option so that the administrator can extend the amount of memory to be used if necessary.
- Operation: Run your program using system-provided resource limits for memory. This might still cause the program to crash or exit, but the impact to the rest of the system will be minimized.
References
Advisories
Packages
Other links
- github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-j2w7-387v-m2rq
- github.com/PHPOffice/PhpSpreadsheet/commit/299993894dce37aa3b64aa23e9a3f4bb77ab…
- github.com/PHPOffice/PhpSpreadsheet/commit/2de29384aa11223ee08136c0e6a9e9981bc1…
- github.com/PHPOffice/PhpSpreadsheet/commit/980b5c294493856f1a25754f1e8a1d2185b9…
- github.com/PHPOffice/PhpSpreadsheet/commit/9a0b48622ebfe93fa48cb9bc09ce57303bb0…
- github.com/PHPOffice/PhpSpreadsheet/commit/da13f40e8760d599b0e8a296017d4b028b20…
- github.com/PHPOffice/PhpSpreadsheet/releases/tag/1.30.7
- github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.1.19
- github.com/PHPOffice/PhpSpreadsheet/releases/tag/2.4.8
- github.com/PHPOffice/PhpSpreadsheet/releases/tag/3.10.8
- github.com/PHPOffice/PhpSpreadsheet/releases/tag/5.10.0
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-2phh-27fw-q4gc PhpSpreadsheet: SSRF whitelist bypass via unre-validated HTTP redirect in Drawing::setPath external image loading | Medium | Also affects phpoffice/phpspreadsheet |
| GHSA-3x94-m842-937c PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service | High | Also affects phpoffice/phpspreadsheet |
| GHSA-rxj4-h86g-25gc PhpSpreadsheet: XmlScanner Bypass via Double-Encoded unentity() TOCTOU Allows XXE and Denial of Service | High | Also affects phpoffice/phpspreadsheet |
| GHSA-xh5m-36r6-47m3 PHPSpreadsheet: XLS/OLE sector-chain self-loop causes memory exhaustion | High | Also affects phpoffice/phpspreadsheet |
| GHSA-2mrg-gjxq-2gvr PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion | High | Also affects phpoffice/phpspreadsheet |
| GHSA-6hq5-7373-42rg PHPSpreadsheet: SSRF bypass via HTTP redirect in WEBSERVICE() domain whitelist | High | Also affects phpoffice/phpspreadsheet |
| GHSA-87m4-826x-3crx PHPSpreadsheet has a patch bypass for CVE-2026-34084 | Critical | Also affects phpoffice/phpspreadsheet |
| GHSA-7c6m-4442-2x6m PhpSpreadsheet has CPU Denial of Service via Unbounded Row Number in XLSX Row Dimensions | High | Also affects phpoffice/phpspreadsheet |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor