PhpSpreadsheet vulnerable to XSS in HTML writer via custom number format codes
Published May 6, 2026
5.4
MEDIUMCVSS 3.1
EPSS 0.25%
Description
PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. The HTML writer skips htmlspecialchars escaping when a cell's formatted value differs from the original value. When a cell has a custom number format containing the text placeholder @ along with any additional literal characters (for example ". @", "@ ", or "x@"), the formatter replaces @ with the cell value and adds the extra characters, causing the formatted value to differ from the original and bypassing HTML escaping entirely. An attacker who can control the cell value and number format of an uploaded spreadsheet that is later converted to HTML and displayed to other users can achieve stored cross-site scripting. This issue is fixed in versions 5.7.0, 3.10.5, 2.4.5, 2.1.16, and 1.30.4.
Affected products
-
- Version <= 1.30.3StatusaffectedConstraints-
- Version >= 2.0.0, <= 2.1.15StatusaffectedConstraints-
- Version >= 2.2.0, <= 2.4.4StatusaffectedConstraints-
- Version >= 3.3.0, <= 3.10.4StatusaffectedConstraints-
- Version >= 4.0.0, <= 5.6.0StatusaffectedConstraints-
- Version
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
| Vendor | Product | Default status | Versions | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PHPOffice | PhpSpreadsheet | n/a |
|
- < 1.30.4
- ≥ 2.0.0 · < 2.1.16
- ≥ 2.2.0 · < 2.4.5
- ≥ 3.3.0 · < 3.10.5
- ≥ 4.0.0 · < 5.7.0
No data.
No Red Hat product state for this CVE.
No package ranges for this CVE.
Remediation
No remediation recorded yet.
References (4)
- https://euvd.enisa.europa.eu/vulnerability/EUVD-2026-28221 Advisory
- https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-hrmw-qprp-wgmc exploitx_refsource_CONFIRMMitigationVendor Advisory
- https://github.com/advisories/GHSA-hrmw-qprp-wgmc Advisory
- https://nvd.nist.gov/vuln/detail/CVE-2026-40296
| Link | Providers | Tags |
|---|---|---|
| https://euvd.enisa.europa.eu/vulnerability/EUVD-2026-28221 | Advisory | |
| https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-hrmw-qprp-wgmc | exploitx_refsource_CONFIRMMitigationVendor Advisory | |
| https://github.com/advisories/GHSA-hrmw-qprp-wgmc | Advisory | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-40296 |
Change history (0)
No recorded changes yet.