CVE-2026-45034: CWE-502: Deserialization of Untrusted Data in PHPOffice PhpSpreadsheet
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.5, CVE-2026-34084 was patched by the helper File::prohibitWrappers. The helper calls parse_url($filename, PHP_URL_SCHEME) and then checks is_string($scheme) && strlen($scheme) > 1 to reject stream wrappers such as phar://, php://, data:// or expect://. The check is not equivalent to "does the path contain a wrapper". When the input has the form phar:///path/file.phar/inner with three or more slashes after the scheme, parse_url returns boolean false instead of returning the scheme string. The is_string($scheme) branch is therefore skipped, the helper returns without throwing, and the caller proceeds. PHP's stream layer, however, still treats phar:///... as a valid phar wrapper and opens the underlying phar file. The result is that IOFactory::load($attackerPath) walks past the patch and still touches the phar wrapper. On PHP 7.x, simply reaching the phar wrapper via is_file is enough for PHP to automatically deserialize the phar metadata, which in turn invokes the magic methods __wakeup and __destruct of an attacker controlled object and gives full RCE. On PHP 8.x, automatic metadata deserialization for plain file ops was removed, so the chain at the PhpSpreadsheet layer reduces to a phar wrapper file read primitive, and RCE only resurfaces if the downstream consumer ever calls Phar::getMetadata. This vulnerability is fixed in 1.30.5.
AI Analysis
Technical Summary
PhpSpreadsheet prior to version 1.30.5 contains a deserialization of untrusted data vulnerability due to an incomplete check in the File::prohibitWrappers helper. The helper attempts to block stream wrappers by parsing the URL scheme and rejecting certain wrappers. However, when the input path uses a phar wrapper with three or more slashes (e.g., phar:///path/file.phar/inner), parse_url returns false for the scheme, causing the check to be bypassed. PHP's stream layer still processes the phar wrapper, leading to automatic deserialization of phar metadata on PHP 7.x during file existence checks. This triggers magic methods (__wakeup and __destruct) in attacker-controlled objects, resulting in full remote code execution. On PHP 8.x, automatic deserialization for plain file operations was removed, so exploitation requires the downstream code to explicitly call Phar::getMetadata. The vulnerability is addressed in PhpSpreadsheet 1.30.5.
Potential Impact
On PHP 7.x environments using vulnerable PhpSpreadsheet versions, an attacker can achieve remote code execution by supplying a crafted file path that exploits the phar wrapper deserialization. On PHP 8.x, the risk is reduced but still present if the application calls Phar::getMetadata on attacker-controlled files. This vulnerability allows execution of arbitrary code without authentication, posing a critical security risk.
Mitigation Recommendations
Upgrade PhpSpreadsheet to version 1.30.5 or later, where this vulnerability is fixed. No other official remediation or temporary fix is documented. Users running PHP 7.x should prioritize patching due to the higher risk of automatic deserialization leading to RCE. For PHP 8.x, ensure that downstream code does not invoke Phar::getMetadata on untrusted inputs. Patch status is not explicitly stated as 'official-fix' in the advisory, but the vulnerability is fixed in version 1.30.5.
CVE-2026-45034: CWE-502: Deserialization of Untrusted Data in PHPOffice PhpSpreadsheet
Description
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Prior to 1.30.5, CVE-2026-34084 was patched by the helper File::prohibitWrappers. The helper calls parse_url($filename, PHP_URL_SCHEME) and then checks is_string($scheme) && strlen($scheme) > 1 to reject stream wrappers such as phar://, php://, data:// or expect://. The check is not equivalent to "does the path contain a wrapper". When the input has the form phar:///path/file.phar/inner with three or more slashes after the scheme, parse_url returns boolean false instead of returning the scheme string. The is_string($scheme) branch is therefore skipped, the helper returns without throwing, and the caller proceeds. PHP's stream layer, however, still treats phar:///... as a valid phar wrapper and opens the underlying phar file. The result is that IOFactory::load($attackerPath) walks past the patch and still touches the phar wrapper. On PHP 7.x, simply reaching the phar wrapper via is_file is enough for PHP to automatically deserialize the phar metadata, which in turn invokes the magic methods __wakeup and __destruct of an attacker controlled object and gives full RCE. On PHP 8.x, automatic metadata deserialization for plain file ops was removed, so the chain at the PhpSpreadsheet layer reduces to a phar wrapper file read primitive, and RCE only resurfaces if the downstream consumer ever calls Phar::getMetadata. This vulnerability is fixed in 1.30.5.
CVSS v4.0
Score 9.2critical
Affected software
pkg:composer/phpoffice/phpspreadsheetRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
PhpSpreadsheet prior to version 1.30.5 contains a deserialization of untrusted data vulnerability due to an incomplete check in the File::prohibitWrappers helper. The helper attempts to block stream wrappers by parsing the URL scheme and rejecting certain wrappers. However, when the input path uses a phar wrapper with three or more slashes (e.g., phar:///path/file.phar/inner), parse_url returns false for the scheme, causing the check to be bypassed. PHP's stream layer still processes the phar wrapper, leading to automatic deserialization of phar metadata on PHP 7.x during file existence checks. This triggers magic methods (__wakeup and __destruct) in attacker-controlled objects, resulting in full remote code execution. On PHP 8.x, automatic deserialization for plain file operations was removed, so exploitation requires the downstream code to explicitly call Phar::getMetadata. The vulnerability is addressed in PhpSpreadsheet 1.30.5.
Potential Impact
On PHP 7.x environments using vulnerable PhpSpreadsheet versions, an attacker can achieve remote code execution by supplying a crafted file path that exploits the phar wrapper deserialization. On PHP 8.x, the risk is reduced but still present if the application calls Phar::getMetadata on attacker-controlled files. This vulnerability allows execution of arbitrary code without authentication, posing a critical security risk.
Mitigation Recommendations
Upgrade PhpSpreadsheet to version 1.30.5 or later, where this vulnerability is fixed. No other official remediation or temporary fix is documented. Users running PHP 7.x should prioritize patching due to the higher risk of automatic deserialization leading to RCE. For PHP 8.x, ensure that downstream code does not invoke Phar::getMetadata on untrusted inputs. Patch status is not explicitly stated as 'official-fix' in the advisory, but the vulnerability is fixed in version 1.30.5.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-08T16:58:28.897Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a39a0f5eed863c81e6b01db
Added to database: 06/22/2026, 20:54:13 UTC
Last enriched: 06/29/2026, 21:50:05 UTC
Last updated: 08/04/2026, 12:46:12 UTC
Views: 160
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.