# CVE-2026-40296: PhpSpreadsheet vulnerable to XSS in HTML writer via custom number format codes

- Severity: Medium 5.4 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.22%, higher than 14% of CVEs (2026-12-02)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-04-28T22:57:13.000Z
- Modified: 2026-10-26T19:10:00.163Z
- Also known as: GHSA-hrmw-qprp-wgmc
- Weaknesses: CWE-79
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- PHPOffice PhpSpreadsheet: >= 4.0.0, <= 5.6.0; >= 3.3.0, <= 3.10.4; >= 2.2.0, <= 2.4.4; >= 2.0.0, <= 2.1.15; <= 1.30.3; before 1.30.4; from 2.0.0 before 2.1.16; from 2.2.0 before 2.4.5; from 3.3.0 before 3.10.5; from 4.0.0 before 5.7.0
- phpoffice/phpspreadsheet (Packagist): from 4.0.0 before 5.7.0; from 3.3.0 before 3.10.5; from 2.2.0 before 2.4.5; from 2.0.0 before 2.1.16; before 1.30.4

## Every score

- GitHub_M: CVSS:3.1 5.4 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N`
- GitHub: CVSS:3.1 5.4 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N`

## References

- <https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-hrmw-qprp-wgmc> (exploit, mitigation, vendor-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-40296> (advisory)
- <https://github.com/PHPOffice/PhpSpreadsheet> (package)

## Sources

- CVE List: [CVE-2026-40296](https://www.cve.org/CVERecord?id=CVE-2026-40296), CVE Terms of Use, modified 2026-05-07
- GitHub Advisory Database: [GHSA-hrmw-qprp-wgmc](https://github.com/advisories/GHSA-hrmw-qprp-wgmc), CC-BY-4.0, modified 2026-05-08
- NVD: [CVE-2026-40296](https://nvd.nist.gov/vuln/detail/CVE-2026-40296), Public domain, modified 2026-10-26

---

Page: https://cve.day/CVE-2026-40296 · Whole record: https://cve.day/CVE-2026-40296.json · Rebuilt by cve.day 2026-11-25T22:59:20.837Z
