CVE-2024-45292: PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via JavaScript hyperlinks
Summary \PhpOffice\PhpSpreadsheet\Writer\Html does not sanitize "javascript:" URLs from hyperlink href attributes, resulting in a Cross-Site Scripting vulnerability. PoC Example target script: Save this file in the same directory: book.xlsx Open index.php in a web browser and click on both links. The first demonstrates the vulnerability in a regular hyperlink and the second in a HYPERLINK() formula.
Published Oct 7, 2024 · Updated Mar 6, 2025
Affected packages
phpoffice/phpspreadsheet
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.2.0, < 2.3.0
- Fixed in
- 2.3.0
- Check
composer show phpoffice/phpspreadsheet
phpoffice/phpspreadsheet
- Ecosystem
- Composer (PHP)
- Affected
- < 1.29.2
- Fixed in
- 1.29.2
- Check
composer show phpoffice/phpspreadsheet
phpoffice/phpspreadsheet
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.0.0, < 2.1.1
- Fixed in
- 2.1.1
- Check
composer show phpoffice/phpspreadsheet
phpoffice/phpexcel
- Ecosystem
- Composer (PHP)
- Affected
- <= 1.8.2
- Fixed in
- No patched version yet
- Check
composer show phpoffice/phpexcel
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
\PhpOffice\PhpSpreadsheet\Writer\Html does not sanitize "javascript:" URLs from hyperlink href attributes, resulting in a Cross-Site Scripting vulnerability.
PoC
Example target script:
<?php
require 'vendor/autoload.php';
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
$spreadsheet = $reader->load(__DIR__ . '/book.xlsx');
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
print($writer->generateHTMLAll());Save this file in the same directory: book.xlsx
Open index.php in a web browser and click on both links. The first demonstrates the vulnerability in a regular hyperlink and the second in a HYPERLINK() formula.
Credited to emilvirkki.
References
- https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-r8w8-74ww-j4wh
- https://github.com/PHPOffice/PhpSpreadsheet/commit/392dd08c5569b623060784e1333454d64df1f03d
- https://github.com/PHPOffice/PhpSpreadsheet/commit/8b9b378ecdc603234a34aab3b293d2cdc8e9210e
- https://github.com/PHPOffice/PhpSpreadsheet/commit/f0b70ed1086348904b27772b264e1605ba6c1d6d
- https://nvd.nist.gov/vuln/detail/CVE-2024-45292
- https://github.com/advisories/GHSA-r8w8-74ww-j4wh
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-108357
PhpSpreadsheet: XmlScanner Bypass via Double-Encoded unentity() TOCTOU Allows XXE and Denial of Service
high8.8Oct 27, 2026CVE-2026-108358
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
high8.8Oct 27, 2026CVE-2026-108359
PhpSpreadsheet ODS Reader: Unbounded number-rows-repeated → CPU & Memory Exhaustion (DoS)
high8.7Oct 27, 2026CVE-2026-108360
PhpSpreadsheet: SSRF whitelist bypass via unre-validated HTTP redirect in Drawing::setPath external image loading
medium6.4Oct 27, 2026CVE-2026-59931
PHPSpreadsheet: SSRF bypass via HTTP redirect in WEBSERVICE() domain whitelist
high7.7Jul 23, 2026CVE-2026-59932
PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion
high7.5Jul 23, 2026
