Skip to main content

Improper Restriction of XML External Entity Reference

CVE-2024-45293

Severity High
Score 7.5/10

Summary

PHPSpreadsheet is a pure PHP library for reading and writing spreadsheet files. The security scanner responsible for preventing XXE attacks in the XLSX reader can be bypassed by slightly modifying the XML structure, utilizing white spaces. On servers that allow users to upload their own Excel (XLSX) sheets, server files, and sensitive information can be disclosed by providing a crafted sheet. The security scan function in "src/PhpSpreadsheet/Reader/Security/XmlScanner.php" contains a flawed XML encoding check to retrieve the input file's XML encoding in the "Utf8" function. The function searches for the XML encoding through a defined regex that looks for "encoding="*"" and/or "encoding='*'"; if not found, it defaults to the "UTF-8" encoding, which bypasses the conversion logic. This logic can be used to pass a "UTF-7" encoded XXE payload by utilizing whitespace before or after the "=" in the attribute definition. Sensitive information disclosure through the XXE on sites that allow users to upload their own Excel spreadsheets and parse them using "PHPSpreadsheet's" Excel parser. All users are advised to upgrade. There are no known workarounds for this vulnerability. This issue affects phpoffice/phpspreadsheet versions through 1.29.0, 2.0.0 through 2.1.0, and 2.2.0 through 2.2.2.

  • LOW
  • NETWORK
  • NONE
  • UNCHANGED
  • NONE
  • NONE
  • HIGH
  • NONE

CWE-611 - Improper Restriction of XML External Entity Reference

Listed 4th in the 'OWASP Top Ten', XML External Entities (XXE) vulnerability allows attackers to provide an XML input that contains an external entity. When the XML is parsed, it can cause data extraction and manipulation, execution of commands, denial-of-service attacks, and server-side request forgery.

Advisory Timeline

  • Published