The vulnerability is a Server-Side Request Forgery (SSRF) and potential Remote Code Execution (RCE) in the PhpSpreadsheet library, identified as GHSA-q4q6-r8wh-5cgh. The root cause is the improper handling of user-supplied filenames, which are passed to PHP functions like is_file() and file_get_contents(). These functions can process PHP stream wrappers (e.g., phar://, ftp://), allowing an attacker to specify a URL instead of a local file path.
Exploitation occurs when a user-controlled filename is passed to the main IOFactory::load() method. This triggers a chain of internal function calls that attempt to validate and read the file. The core of the vulnerability lies in functions that perform file existence checks without explicitly blocking stream wrappers.
The patch addresses this by introducing a new validation function, PhpOffice\PhpSpreadsheet\Shared\File::prohibitWrappers(), which inspects the filename for URL schemes and throws an exception if one is found. This fix is applied in key file-handling functions:
PhpOffice\PhpSpreadsheet\Shared\File::assertFile(): This central validation function is now secure, protecting most file-reading operations initiated by IOFactory::load().
PhpOffice\PhpSpreadsheet\Reader\Xml::canRead(): This function represented a separate vulnerable path as it directly used file_get_contents(). The patch now routes its validation through the hardened assertFile().
PhpOffice\PhpSpreadsheet\Helper\Downloader::__construct(): This class was also found to have weak path validation, which was strengthened by using realpath() more securely to prevent path traversal and stream wrapper attacks.
During an exploit, these functions would appear in a runtime profile as they are responsible for processing the malicious path that triggers the SSRF or RCE.