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

High severity, published 2026-07-23. Update phpoffice/phpspreadsheet to the fixed version of your branch (5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6): composer update phpoffice/phpspreadsheet.

Canonical URL: https://buzzphp.com/security/ghsa-6hq5-7373-42rg · Data from GitHub as of 2026-11-25.

| | |
| --- | --- |
| Severity | high (CVSS 7.7) |
| Published | 2026-07-23 |
| Updated | 2026-07-23 |
| CVE | [CVE-2026-59931](https://nvd.nist.gov/vuln/detail/CVE-2026-59931) |
| GHSA | [GHSA-6hq5-7373-42rg](https://github.com/advisories/GHSA-6hq5-7373-42rg) |
| Weakness | CWE-918 |

| Package | Affected versions | Fixed in |
| --- | --- | --- |
| phpoffice/phpspreadsheet | >= 4.0.0, <= 5.8.0 or >= 3.3.0, <= 3.10.6 or >= 2.2.0, <= 2.4.6 or >= 2.0.0, <= 2.1.17 or <= 1.30.5 | 5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6 |

## What to do

Update phpoffice/phpspreadsheet to the fixed version of your branch (5.8.1, 3.10.7, 2.4.7, 2.1.18, 1.30.6): composer update phpoffice/phpspreadsheet.

Check which version you run with `composer show phpoffice/phpspreadsheet`, and every affected package with `composer audit`.

## About this advisory

Summary

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 filegetcontents() 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.

Details

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 filegetcontents($url, false, $ctx) to fetch the content.



## Links

- [GHSA-6hq5-7373-42rg on GitHub](https://github.com/advisories/GHSA-6hq5-7373-42rg)
- [CVE-2026-59931 on the National Vulnerability Database](https://nvd.nist.gov/vuln/detail/CVE-2026-59931)
- [All Composer security advisories](https://buzzphp.com/security)
