CVE-2024-48917: PHPSpreadsheet XXE Vulnerability in XLSX Reader

phpoffice/phpspreadsheet Updated 02 Oct 2025

Summary

18/11/2024
Yes i
High
7.5

CVE-2024-48917: XXE in PHPSpreadsheet's XLSX reader. Affects phpoffice/phpspreadsheet across 4 version ranges.

< 1.29.4 >= 2.0.0, < 2.1.3 >= 2.2.0, < 2.3.2 >= 3.3.0, < 3.4.0

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

PHPSpreadsheet is a popular library for reading and writing spreadsheet files in PHP. It supports various formats, including XLSX, and is widely used in applications that require data manipulation and reporting. The library provides features such as reading cell data, formatting, and writing to different file types. However, it has been found to be vulnerable to XML External Entity (XXE) attacks, which can lead to unauthorized access to sensitive data or system resources.

Vulnerability Detail

The vulnerability arises from the XmlScanner class in PHPSpreadsheet, specifically in its scan method, which is intended to prevent XXE attacks. A bypass was discovered that allows an attacker to exploit the regex patterns used to determine the encoding of XML files. By crafting a payload with UTF-7 encoding and appending a comment indicating UTF-8 encoding, the attacker can manipulate the XML parsing process. This can lead to unauthorized HTTP requests being made to an attacker-controlled server, potentially exposing sensitive information or allowing further exploitation.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.29.4 1.29.4
    composer require phpoffice/phpspreadsheet:1.29.4
  • >= 2.0.0, < 2.1.3 2.1.3
    composer require phpoffice/phpspreadsheet:2.1.3
  • >= 2.2.0, < 2.3.2 2.3.2
    composer require phpoffice/phpspreadsheet:2.3.2
  • >= 3.3.0, < 3.4.0 3.4.0
    composer require phpoffice/phpspreadsheet:3.4.0

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, avoid processing untrusted XML files with PHPSpreadsheet until the library is updated. Additionally, ensure that your application does not allow user-uploaded XML files unless they are properly validated and sanitized.

Conclusion

The CVE-2024-48917 vulnerability in PHPSpreadsheet poses a significant risk due to its potential for XXE attacks. It is crucial for developers using this library to update to the latest patched versions to mitigate the risk. Additionally, employing best practices for XML handling can further enhance application security.

See every vulnerability recorded for phpoffice/phpspreadsheet →

Share this vulnerability

FAQ

An XML External Entity (XXE) attack is a type of security vulnerability that allows an attacker to interfere with the processing of XML data. It can lead to data exposure, denial of service, or server-side request forgery.

You can check if your application is affected by using Vulert, which monitors open-source vulnerabilities in real-time. You can also use the Vulert playground to analyze your composer.lock file without signing up.

Exploiting this vulnerability can lead to unauthorized access to sensitive data, potential data leaks, and further exploitation of the server hosting the application.

To protect your application, ensure that you validate and sanitize all XML inputs, disable external entity processing in your XML parsers, and keep your dependencies updated.

If you cannot update PHPSpreadsheet right away, implement strict input validation and avoid processing untrusted XML files until the library is updated.

Related vulnerabilities

Recent vulnerabilities recorded for phpoffice/phpspreadsheet.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.29.4 1.29.4
    composer require phpoffice/phpspreadsheet:1.29.4
  • >= 2.0.0, < 2.1.3 2.1.3
    composer require phpoffice/phpspreadsheet:2.1.3
  • >= 2.2.0, < 2.3.2 2.3.2
    composer require phpoffice/phpspreadsheet:2.3.2
  • >= 3.3.0, < 3.4.0 3.4.0
    composer require phpoffice/phpspreadsheet:3.4.0

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback