CVE-2024-45292: PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via JavaScript hyperlinks

Published Oct 7, 2024
·
Updated

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.

Other sources

PHPSpreadsheet is a pure PHP library for reading and writing spreadsheet files. \PhpOffice\PhpSpreadsheet\Writer\Html does not sanitize "javascript:" URLs from hyperlink href attributes, resulting in a Cross-Site Scripting vulnerability. This issue has been addressed in release versions 1.29.2, 2.1.1, and 2.3.0. All users are advised to upgrade. There are no known workarounds for this vulnerability.

MITRE

Affected Software

7 affected componentsFixes available
composer/phpoffice/phpexcel<=1.8.2
composer/phpoffice/phpspreadsheet>=2.0.0<2.1.1
2.1.1
composer/phpoffice/phpspreadsheet<1.29.2
1.29.2
composer/phpoffice/phpspreadsheet>=2.2.0<2.3.0
2.3.0
PHPOffice phpspreadsheet<1.29.2
PHPOffice phpspreadsheet>=2.0.0<2.1.1
PHPOffice phpspreadsheet>=2.2.0<2.3.0

Event History

Oct 7, 2024
Advisory Published
via GitHub·03:58 PM
CVE Published
via MITRE·08:06 PM
Data Sourced
via MITRE·08:06 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:15 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-45292?

CVE-2024-45292 is classified as a Cross-Site Scripting vulnerability due to improper handling of "javascript:" URLs.

2

How do I fix CVE-2024-45292?

To fix CVE-2024-45292, update PhpSpreadsheet to version 2.1.1 or later, or to version 1.29.2.

3

Which versions of PhpSpreadsheet are affected by CVE-2024-45292?

CVE-2024-45292 affects PhpSpreadsheet versions from 2.0.0 up to, but not including, 2.1.1 and all versions before 1.29.2.

4

What kind of attacks can be performed using CVE-2024-45292?

CVE-2024-45292 can allow attackers to execute arbitrary JavaScript in the context of the user’s browser, leading to potential data theft or session hijacking.

5

Is there a known exploit for CVE-2024-45292?

While specific exploit details are not provided, the nature of the Cross-Site Scripting vulnerability implies it can be exploited through constructed hyperlinks.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203