CVE-2019-12331 · mitre
CVE-2019-12331
PHPOffice PhpSpreadsheet before 1.8.0 has an XXE issue. The XmlScanner decodes the sheet1.xml from an .xlsx to utf-8 if something else than UTF-8 is declared in the header. This was a security measurement to prevent CVE-2018-19277 but the fix is not sufficient. By double-encoding the the xml payload to utf-7 it is possible to bypass the check for the string ‚<!ENTITY‘ and thus allowing for an xml external entity processing (XXE) attack.
Published 2019-11-07, last changed 2026-06-17. Weakness: CWE-611.
How to fix
Upgrade to a fixed version: phpoffice/phpspreadsheet 1.8.0 (Packagist). For the version that clears every advisory for your installed version, ask an agent for get_remediation.
Where the flaw is in the code
Fixed in PHPOffice/PhpSpreadsheet by pull request #1041, 0e6238c69e. Functions changed by the fix: __construct, shutdown, __destruct, identifyLibxmlDisableEntityLoaderAvailability, threadSafeLibxmlDisableEntityLoaderAvailability, disableEntityLoaderCheck, toUtf8, scan, getLibXmlLoaderOptions, setLibXmlDisableEntityLoader, getLibXmlDisableEntityLoader. Regression tests: tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php, tests/data/Reader/Xml/XEETestInvalidUTF-7_DoubleEncoded.xml. Confidence: verified (a record names this commit as the fix, and it changed these functions).
Timeline
| 2019-11-07 | Published |
| 2019-11-20 | Package advisory GHSA-vvwv-h69m-wg6f |
| 2026-06-17 | Record last changed |
| 2026-11-30 | EPSS when our history starts: 1.35% |
| 2026-12-03 | Code-level analysis added |
Affected packages
| Advisory | Package | Fixed in |
|---|---|---|
| GHSA-vvwv-h69m-wg6f | phpoffice/phpspreadsheet (Packagist) | 1.8.0 |
| GHSA-vvwv-h69m-wg6f | phpoffice/phpexcel (Packagist) | no fix yet |
Also known as: GHSA-vvwv-h69m-wg6f
Related
| CVE | Published | CVSS | Summary |
|---|---|---|---|
| CVE-2026-108360 | 2026-10-22 | 6.4 | PhpSpreadsheet: SSRF whitelist bypass via unre-validated HTTP redirect in Drawing::setPath external image loading |
| CVE-2026-108359 | 2026-10-22 | 8.7 | PhpSpreadsheet ODS Reader: Unbounded number-rows-repeated → CPU & Memory Exhaustion (DoS) |
| CVE-2026-108358 | 2026-10-22 | 8.8 | PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service |
| CVE-2026-108357 | 2026-10-22 | 8.8 | PhpSpreadsheet: XmlScanner Bypass via Double-Encoded unentity() TOCTOU Allows XXE and Denial of Service |
| CVE-2026-59932 | 2026-07-28 | 7.5 | PhpSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion |
| CVE-2026-59933 | 2026-07-28 | 7.5 | PhpSpreadsheet: XLS/OLE sector-chain self-loop causes memory exhaustion |
| CVE-2026-59931 | 2026-07-28 | 7.7 | PhpSpreadsheet: SSRF bypass via HTTP redirect in WEBSERVICE() domain whitelist |
| CVE-2026-45034 | 2026-06-22 | 9.2 | PhpSpreadsheet: File::prohibitWrappers bypass |
Add it to your agent
One command for Claude Code; setup for Claude Desktop, Cursor and others. No signup or key.
claude mcp add --transport http keygraph-cve https://cve-mcp.keygraph.io/mcp
Then ask for triage_cve CVE-2019-12331, or call /api/v1/vulnerabilities/CVE-2019-12331. To prove whether it is exploitable in your running app, run Shannon, Keygraph's open-source AI pentester.