high CVSS 7.5 EPSS <0.1%

CVE-2026-40902·PHP vulnerability

PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.4, 2.1.16, 2.4.5, 3.10.5, and 5.7.0, 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. This vulnerability is fixed in 1.30.4, 2.1.16, 2.4.5, 3.10.5, and 5.7.0.

Severity
high
Software
PHP
Fixed in
5.7.0
Published

How likely is exploitation

FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at <0.1% — higher than 13% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.

Read the two together. CVE-2026-40902 scores 7.5 on CVSS, so a successful attack would be serious — but at <0.1%, almost nobody is currently attempting it. That is a different situation from a flaw under mass exploitation, and it is usually the difference between patching on your next maintenance window and patching tonight.

Affected versions

From: 4.0.0

Until: 5.7.0

Fixed in: 5.7.0

How to fix this CVE

Update PHP and PhpSpreadsheet to patched versions immediately to prevent denial-of-service attacks via maliciously crafted XLSX files. Upgrade to PhpSpreadsheet 5.7.0 or later, and ensure your PHP installation is fully patched. This vulnerability allows attackers to exhaust CPU resources by submitting specially crafted spreadsheet files that trigger excessive row iteration.

sudo dnf update php php-pear

Defensia detects this vulnerability

WAF mitigation (if patching is not yet possible)

Add this rule to your WAF to block exploitation attempts while you schedule the patch.

Implement rate limiting on file upload endpoints and restrict XLSX file uploads to authenticated users only. Additionally, configure your WAF to reject spreadsheet files larger than 10MB or with XML elements containing row attributes with values exceeding 1048576 (the maximum valid row number in spreadsheets).

How to check if you are affected

  1. Run `php -v` to check the current PHP version installed on your system
  2. Check if PhpSpreadsheet is installed by running `composer show phpoffice/phpspreadsheet` in your project root, or grep for 'phpoffice/phpspreadsheet' in composer.lock
  3. Search web server logs for XLSX file uploads or POST requests containing 'row r=' patterns with excessively large numeric values (e.g., 'row r="999999999"') in the last 30 days
  4. After patching, re-run `composer show phpoffice/phpspreadsheet` or `php -v` to confirm the version is 5.7.0 or later

FAQ

What is CVE-2026-40902?

CVE-2026-40902 is a denial-of-service vulnerability in PhpSpreadsheet that allows attackers to craft minimal XLSX files with invalid row numbers that bypass validation, causing the library to attempt billions of loop iterations and consume all available CPU resources.

Is CVE-2026-40902 being actively exploited?

No, CVE-2026-40902 is not currently listed on the CISA KEV catalog and no public exploits are available, but the vulnerability can be triggered by any user with the ability to upload or process XLSX files.

What versions of PHP are affected by CVE-2026-40902?

Any PHP installation using PhpSpreadsheet versions 4.0.0 through 5.6.x is vulnerable. The vulnerability is fixed in PhpSpreadsheet 5.7.0 and later versions (also patched in 1.30.4, 2.1.16, 2.4.5, and 3.10.5 for earlier major versions).

How do I check if my server is vulnerable to CVE-2026-40902?

Run `composer show phpoffice/phpspreadsheet | grep Version` in your project directory. If the version is below 5.7.0, your server is vulnerable. You can also inspect your composer.lock file for the installed version.

Does Defensia detect CVE-2026-40902?

Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PHP and PhpSpreadsheet are installed on a monitored server, CVE-2026-40902 will appear in your dashboard with remediation steps.

Related PHP CVEs

CVE-2024-5932CVSS 10The GiveWP – Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all versions up to, and including, 3.14.1 via deserialization of untrusted input from the 'give_title' parameter. This makes it possible for unauthenticated attackers to inject a PHP Object. The additional presence of a POP chain allows attackers to execute code remotely, and to delete arbitrary files.
CVE-2026-39337CVSS 10ChurchCRM is an open-source church management system. Prior to 7.1.0, critical pre-authentication remote code execution vulnerability in ChurchCRM's setup wizard allows unauthenticated attackers to inject arbitrary PHP code during the initial installation process, leading to complete server compromise. The "$dbPassword" variable is not sanitized. This vulnerability exists due to an incomplete fix for CVE-2025-62521. This vulnerability is fixed in 7.1.0.
CVE-2025-62521CVSS 10ChurchCRM is an open-source church management system. Prior to version 5.21.0, a pre-authentication remote code execution vulnerability in ChurchCRM's setup wizard allows unauthenticated attackers to inject arbitrary PHP code during the initial installation process, leading to complete server compromise. The vulnerability exists in `setup/routes/setup.php` where user input from the setup form is directly concatenated into a PHP configuration template without any validation or sanitization. Any parameter in the setup form can be used to inject PHP code that gets written to `Include/Config.php`, which is then executed on every page load. This is more severe than typical authenticated RCE vulnerabilities because it requires no credentials and affects the installation process that administrators must complete. Version 5.21.0 patches the issue.
CVE-2025-25174CVSS 10Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') vulnerability in beeteam368 BeeTeam368 Extensions beeteam368-extensions allows PHP Local File Inclusion.This issue affects BeeTeam368 Extensions: from n/a through <= 1.9.4.
CVE-2025-46348CVSS 10YesWiki is a wiki system written in PHP. Prior to version 4.5.4, the request to commence a site backup can be performed and downloaded without authentication. The archives are created with a predictable filename, so a malicious user could create and download an archive without being authenticated. This could result in a malicious attacker making numerous requests to create archives and fill up the file system, or by downloading the archive which contains sensitive site information. This issue has been patched in version 4.5.4.

References

Track CVEs across your fleet automatically

Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-40902. Free for 1 server.

Get started free