PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via style informationGHSA-wgmf-q9vr-vww6
MEDIUMFix: PHPOffice/PhpSpreadsheet#3957GHSA-wgmf-q9vr-vww6 is a medium-severity (CVSS 5.4) Cross-site Scripting (XSS) vulnerability in phpoffice/phpspreadsheet. 1 public exploit or proof-of-concept reference is indexed, so weaponization risk is real. A fix is available for phpoffice/phpspreadsheet — see the affected versions and patch details below.
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for GHSA-wgmf-q9vr-vww6.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
phpoffice/phpspreadsheet🐘phpoffice/phpspreadsheet🐘phpoffice/phpexcelReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Summary
\PhpOffice\PhpSpreadsheet\Writer\Html doesn't sanitize spreadsheet styling information such as font names, allowing an attacker to inject arbitrary JavaScript on the page.
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. An alert should be displayed.
Impact
Full takeover of the session of users viewing spreadsheet files as HTML.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | phpoffice/phpspreadsheet | ≥ 2.0.0&&< 2.1.0 | 2.1.0composer require phpoffice/phpspreadsheet:^2.1.0 |
| 🐘Packagist | phpoffice/phpspreadsheet | all versions | 1.29.1composer require phpoffice/phpspreadsheet:^1.29.1 |
| 🐘Packagist | phpoffice/phpexcel | all versions | No fix |
Affected Products
phpspreadsheetphpofficeResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for phpoffice/phpspreadsheet, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update phpoffice/phpspreadsheet to 2.1.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-wgmf-q9vr-vww6 is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Frequently Asked Questions
Is GHSA-wgmf-q9vr-vww6 in your dependencies?
Find it across Packagist, including transitive dependencies.