PhpSpreadsheet versions up to 5.12.0 contain a server-side request forgery (SSRF) vulnerability. This flaw allows attackers to craft spreadsheets with external image URLs that, when processed, cause the software to fetch internal network resources. The vulnerability arises because the writer component re-fetches external drawing URLs using file_get_contents() and follows redirects, potentially leaking internal response data in generated spreadsheet files.
PhpSpreadsheet versions from 5.5.0 up to and including 5.9.0 contain a server-side request forgery (SSRF) vulnerability in the Worksheet\Drawing::setPath() method. The vulnerability arises because the external image URL whitelist check is applied only once on the initial URL, and HTTP redirects are followed without re-validation, allowing an attacker to redirect requests to internal or otherwise restricted endpoints. This results in a blind SSRF where the server issues internal GET requests without exfiltrating response content. A fix is available in version 5.10.0.
PhpSpreadsheet's ODS reader has an unbounded number-rows-repeated attribute handling flaw that can cause memory exhaustion. When processing an OpenDocument Spreadsheet (.ods) file, the reader expands the number-rows-repeated attribute without an upper bound, potentially materializing millions of cells from a small file. This leads to PHP fatal out-of-memory errors. All maintained versions up to 5.9.0 are affected. The vulnerability is fixed in versions 5.10.0, 3.10.8, 2.4.8, 2.1.19, and 1.30.7.
PhpSpreadsheet versions prior to 5.10.0, 3.10.8, 2.4.8, 2.1.19, and 1.30.7 contain a vulnerability in the XmlScanner::scan() method. The scanner's regex pattern only accounts for NULL byte interleaving when detecting <!DOCTYPE declarations, but ISO-2022 escape sequences can bypass this detection. This allows malicious XLSX files with crafted XML to include DOCTYPE declarations that enable XML External Entity (XXE) attacks and Denial of Service (DoS) via quadratic entity expansion. The issue affects all PHP versions for DoS and PHP versions below 8.0 or when LIBXML_NOENT is used for XXE/SSRF. A fix is available in the stated versions.
PhpSpreadsheet's XmlScanner performs two scans on XML content, each followed by an entity decoding callback that runs after pattern checks. This allows a double-encoded entity sequence to bypass detection of dangerous <!DOCTYPE declarations, enabling XML External Entity (XXE) injection and Denial of Service (DoS) via entity expansion. The vulnerability affects PhpSpreadsheet versions >=3.3.0 <3.10.8 and >=4.0.0 <5.10.0. It is exploitable for DoS on all PHP versions and for XXE/SSRF on PHP versions below 8.0 or when LIBXML_NOENT is used. Fixed in versions 3.10.8 and 5.10.0.
PhpSpreadsheet's SpreadsheetML XML reader does not validate the ss:Index row attribute against the maximum allowed row count, allowing an attacker to set an extremely large row index. This causes the internal cachedHighestRow to inflate to about 1 billion, leading to CPU exhaustion when iterating rows. The vulnerability enables denial of service by exhausting server CPU resources with a small crafted XML file. The flaw affects multiple versions of PhpSpreadsheet prior to fixed releases. A patch is available that adds validation to limit the row index to the maximum allowed value.
PhpSpreadsheet versions prior to 5.6.0, 3.10.4, 2.4.4, 2.1.15, and 1.30.3 contain a vulnerability in the IOFactory::load function where user-controlled filenames can exploit PHP stream wrappers such as phar://, ftp://, and ssh2.sftp://. This leads to Server-Side Request Forgery (SSRF) and potentially Remote Code Execution (RCE) through deserialization of malicious Phar archives. The vulnerability arises because the is_file check used to validate filenames is PHP wrapper aware, allowing attackers to bypass file validation. A proof of concept demonstrates creating a malicious Phar file that executes arbitrary shell commands upon loading. The issue affects multiple versions and has been fixed in the stated versions.
PhpSpreadsheet versions prior to 5.7.0, 3.10.5, 2.4.5, 2.1.16, and 1.30.4 contain a stored cross-site scripting (XSS) vulnerability in the HTML writer. This occurs because the code conditionally applies HTML escaping only when the formatted cell data matches the original data. Custom number formats using the '@' text placeholder with additional characters cause the escaping to be skipped, allowing unescaped HTML injection. This can lead to stored XSS when user-uploaded XLSX files are converted to HTML and displayed to other users.
PhpSpreadsheet's HTML Writer component has a cross-site scripting (XSS) vulnerability due to improper escaping when using custom number formats containing the '@' text placeholder with additional literal text. This flaw allows malicious XLSX files to inject arbitrary HTML and JavaScript into generated HTML output. The vulnerability affects multiple versions prior to fixed releases and can lead to XSS if the HTML output is served by a web server.