high CVSS 7.5

CVE-2024-47873·PHP vulnerability

PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. The XmlScanner class has a scan method which should prevent XXE attacks. However, prior to versions 1.9.4, 2.1.3, 2.3.2, and 3.4.0, the regexes used in the `scan` method and the findCharSet method can be bypassed by using UCS-4 and encoding guessing. An attacker can bypass the sanitizer and achieve an XML external entity attack. Versions 1.9.4, 2.1.3, 2.3.2, and 3.4.0 fix the issue.

Severity
high
Software
PHP
Fixed in
3.4.0
Published
2024-11-18

Affected versions

From: 3.3.0

Until: 3.4.0

Fixed in: 3.4.0

How to fix this CVE

Upgrade PHP and PhpSpreadsheet to version 3.4.0 or later to patch the XXE vulnerability in the XmlScanner class. This vulnerability allows attackers to bypass XML sanitization through UCS-4 encoding and character set guessing, potentially leading to information disclosure. Update your PHP environment and rebuild any Docker containers or deployment artifacts using the patched versions.

sudo dnf update php php-cli php-fpm

Defensia detects this vulnerability

What an exploitation attempt looks like

Sample log line indicative of exploitation attempts:

POST|GET request containing spreadsheet file upload (.xlsx, .xls, .xml) with payload including XML declarations like `<!DOCTYPE` followed by `SYSTEM` or `PUBLIC` keywords referencing `file://`, `http://`, or gopher protocols; regex: `(<!DOCTYPE|<!ENTITY).*?(SYSTEM|PUBLIC).*?(file|http|gopher)://`

WAF mitigation (if patching is not yet possible)

Add this rule to your WAF to block exploitation attempts while you schedule the patch.

Block or sanitize multipart form uploads containing XML Content-Type headers with DOCTYPE or ENTITY declarations; implement strict file type validation on spreadsheet uploads and reject files containing XXE patterns before they reach the application layer.

How to check if you are affected

  1. Run `php -v` to check the current PHP version installed on the system.
  2. Check if PhpSpreadsheet is installed via Composer by running `composer show phpoffice/phpspreadsheet` or examine vendor/phpoffice/phpspreadsheet/composer.json for version information.
  3. Search application logs and web server access logs for malicious XML payloads containing DOCTYPE declarations or ENTITY definitions targeting local file systems (e.g., patterns like `<!DOCTYPE` or `SYSTEM "file://`).
  4. Verify the patch was applied by confirming PHP version is current and re-running `composer show phpoffice/phpspreadsheet` to confirm version 3.4.0 or later is installed.

FAQ

What is CVE-2024-47873?

CVE-2024-47873 is an XXE (XML External Entity) injection vulnerability in PhpSpreadsheet's XmlScanner class that can be bypassed using UCS-4 encoding and character set guessing techniques, allowing attackers to read sensitive files or perform information disclosure attacks through maliciously crafted spreadsheet files.

Is CVE-2024-47873 being actively exploited?

No, according to CISA's KEV catalog, CVE-2024-47873 is not currently listed as actively exploited in the wild, and no public exploits are publicly available.

What versions of PHP are affected by CVE-2024-47873?

PhpSpreadsheet versions 3.3.0 through 3.3.x are affected; patched versions include 1.9.4, 2.1.3, 2.3.2, and 3.4.0 depending on your version branch.

How do I check if my server is vulnerable to CVE-2024-47873?

Run `composer show phpoffice/phpspreadsheet` to determine the installed version; if it is below 3.4.0, 2.3.2, 2.1.3, or 1.9.4 depending on your branch, your system is vulnerable.

Does Defensia detect CVE-2024-47873?

Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PHP and PhpSpreadsheet are installed on a monitored server, CVE-2024-47873 will appear in your dashboard with remediation steps.

Related PHP CVEs

CVE-2025-62521CVSS 10ChurchCRM is an open-source church management system. Prior to version 5.21.0, a pre-authentication remote code execution vulnerability in ChurchCRM's setup wizard allows unauthenticated attackers to inject arbitrary PHP code during the initial installation process, leading to complete server compromise. The vulnerability exists in `setup/routes/setup.php` where user input from the setup form is directly concatenated into a PHP configuration template without any validation or sanitization. Any parameter in the setup form can be used to inject PHP code that gets written to `Include/Config.php`, which is then executed on every page load. This is more severe than typical authenticated RCE vulnerabilities because it requires no credentials and affects the installation process that administrators must complete. Version 5.21.0 patches the issue.
CVE-2026-28289CVSS 10FreeScout is a free help desk and shared inbox built with PHP's Laravel framework. A patch bypass vulnerability for CVE-2026-27636 in FreeScout 1.8.206 and earlier allows any authenticated user with file upload permissions to achieve Remote Code Execution (RCE) on the server by uploading a malicious .htaccess file using a zero-width space character prefix to bypass the security check. The vulnerability exists in the sanitizeUploadedFileName() function in app/Http/Helper.php. The function contains a Time-of-Check to Time-of-Use (TOCTOU) flaw where the dot-prefix check occurs before sanitization removes invisible characters. This vulnerability is fixed in 1.8.207.
CVE-2025-25174CVSS 10Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') vulnerability in beeteam368 BeeTeam368 Extensions beeteam368-extensions allows PHP Local File Inclusion.This issue affects BeeTeam368 Extensions: from n/a through <= 1.9.4.
CVE-2024-5932CVSS 10The GiveWP – Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all versions up to, and including, 3.14.1 via deserialization of untrusted input from the 'give_title' parameter. This makes it possible for unauthenticated attackers to inject a PHP Object. The additional presence of a POP chain allows attackers to execute code remotely, and to delete arbitrary files.
CVE-2025-46348CVSS 10YesWiki is a wiki system written in PHP. Prior to version 4.5.4, the request to commence a site backup can be performed and downloaded without authentication. The archives are created with a predictable filename, so a malicious user could create and download an archive without being authenticated. This could result in a malicious attacker making numerous requests to create archives and fill up the file system, or by downloading the archive which contains sensitive site information. This issue has been patched in version 4.5.4.

References

Track CVEs across your fleet automatically

Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-47873. Free for 1 server.

Get started free