CVE-2024-45046: PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via style information
5.4
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.30609%
CWE
Published
8/29/2024
Updated
3/6/2025
KEV Status
No
Technology
PHP
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| phpoffice/phpspreadsheet | composer | >= 2.0.0, < 2.1.0 | 2.1.0 |
| phpoffice/phpspreadsheet | composer | < 1.29.1 | 1.29.1 |
| phpoffice/phpexcel | composer | <= 1.8.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from unsanitized font name input in style generation. The commit diff shows the fix added htmlspecialchars() to sanitize font names in createCSSStyleFont. Prior to this fix, a font name like 'Calibri</style><script>alert(1)</script>' would inject executable JavaScript into the HTML output. The test case 'testXssInFontName' in XssVulnerabilityTest.php demonstrates this attack vector, and the patch specifically addresses it by escaping font names.