All vulnerabilities

Packagist

CVE-2026-59931

PHPSpreadsheet: SSRF bypass via HTTP redirect in WEBSERVICE() domain whitelist

Severity
High 7.7
Published
23 Jul 2026
Last changed
23 Jul 2026
Added to UpHeron
22 Oct 2026
Fixed in
1.30.6, 2.1.18, 2.4.7, 3.10.7, 5.8.1
Exploit chance
0.5% in the next 30 daysHigher than 41% of CVEs. EPSS by FIRST, 19 Nov 2026
Weakness
Server-side request forgery (CWE-918)
Attack
Over the network · Needs a user account · No user action needed
Attacker can
Read data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
Also known as
GHSA-6hq5-7373-42rg
Sources
OSV.dev and GitHub

Description

The domain whitelist introduced in PhpSpreadsheet 5.4.0 for the WEBSERVICE() formula function can be bypassed via HTTP redirect. The whitelist validates only the initial URL's hostname, but file_get_contents() follows 302/301 redirects by default without re-validating the redirect target against the whitelist. This allows an attacker to reach internal services through a whitelisted domain that issues an HTTP redirect.

In Calculation/Web/Service.php, the webService() method validates the URL's host against a domain whitelist set via Spreadsheet::setDomainWhiteList(). If the host passes validation, the method calls file_get_contents($url, false, $ctx) to fetch the content.

The stream context does not disable redirect following:

PHP's HTTP stream wrapper follows redirects automatically (up to 20 hops by default). The redirect target URL is not re-validated against the domain whitelist.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
phpoffice/phpspreadsheetPackagist · osv:Packagist:phpoffice/phpspreadsheet
  • Every version before 1.30.6
  • From 2.0.0 before 2.1.18
  • From 2.2.0 before 2.4.7
  • From 3.3.0 before 3.10.7
  • From 4.0.0 before 5.8.1

About phpoffice/phpspreadsheet

Monthly downloads (Packagist)
15,804,115Packagist, 16 Nov 2026
Total downloads (Packagist)
372,631,237Packagist, 16 Nov 2026

References