critical CVSS 9.8

CVE-2025-54418·PHP vulnerability

CodeIgniter is a PHP full-stack web framework. A command injection vulnerability present in versions prior to 4.6.2 affects applications that use the ImageMagick handler for image processing (`imagick` as the image library) and either allow file uploads with user-controlled filenames and process uploaded images using the `resize()` method or use the `text()` method with user-controlled text content or options. An attacker can upload a file with a malicious filename containing shell metacharacters that get executed when the image is processed or provide malicious text content or options that get executed when adding text to images Users should upgrade to v4.6.2 or later to receive a patch. As a workaround, switch to the GD image handler (`gd`, the default handler), which is not affected by either vulnerability. For file upload scenarios, instead of using user-provided filenames, generate random names to eliminate the attack vector with `getRandomName()` when using the `move()` method, or use the `store()` method, which automatically generates safe filenames. For text operations, if one must use ImageMagick with user-controlled text, sanitize the input to only allow safe characters and validate/restrict text options.

Severity
critical
Software
PHP
Fixed in
4.6.2
Published
2025-07-28

Affected versions

From: 4.0.0

Until: 4.6.2

Fixed in: 4.6.2

How to fix this CVE

Upgrade CodeIgniter to version 4.6.2 or later to patch a critical command injection vulnerability in the ImageMagick image handler. If immediate patching is not possible, disable ImageMagick and switch to the GD image library (the default handler), or implement strict input validation and filename sanitization for file uploads and text operations.

sudo dnf update php php-pecl-imagick

Defensia detects this vulnerability

What an exploitation attempt looks like

Sample log line indicative of exploitation attempts:

POST requests with file uploads containing shell metacharacters in filenames (e.g., `$(command)`, `` `backticks` ``, `|pipe|`, `&ampersand&`, `;semicolon;`) combined with ImageMagick processing, or POST/GET parameters with command substitution patterns passed to text() method; look for error logs showing ImageMagick/convert process execution with unexpected arguments

WAF mitigation (if patching is not yet possible)

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

Implement WAF rules to reject file uploads with names containing shell metacharacters (regex: `[;&|$`()\[\]{}]`) and validate image processing text parameters against a whitelist of safe characters, blocking requests containing command substitution patterns like `$()`, backticks, or pipe operators.

How to check if you are affected

  1. Check the CodeIgniter version: grep -r "const VERSION" application/Config/Constants.php or composer show codeigniter4/framework | grep '^codeigniter4'
  2. Verify if ImageMagick handler is configured: grep -E "'image'.*=>.*'imagick'" application/Config/Images.php
  3. Search application logs for ImageMagick processing errors or shell metacharacter patterns in uploaded filenames: grep -i 'imagick\|convert\|identify' /var/log/php-errors.log
  4. Confirm the patch by verifying CodeIgniter version is >= 4.6.2: composer show codeigniter4/framework | grep 'versions'

FAQ

What is CVE-2025-54418?

CVE-2025-54418 is a critical command injection vulnerability in CodeIgniter's ImageMagick image handler that allows attackers to execute arbitrary system commands through malicious filenames in file uploads or unsanitized text content passed to image processing methods.

Is CVE-2025-54418 being actively exploited?

As of the latest NVD data, CVE-2025-54418 is not listed on the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits are currently documented, though the critical CVSS score warrants immediate patching.

What versions of CodeIgniter are affected by CVE-2025-54418?

CodeIgniter versions 4.0.0 through 4.6.1 are vulnerable when using the ImageMagick handler. Version 4.6.2 and later contain the patch.

How do I check if my CodeIgniter application is vulnerable to CVE-2025-54418?

Run `composer show codeigniter4/framework` to check your version, and inspect application/Config/Images.php for `'image' => 'imagick'` configuration. If both conditions are true and your version is below 4.6.2, you are vulnerable.

Does Defensia detect CVE-2025-54418?

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

Related PHP CVEs

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-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-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-2026-39337CVSS 10ChurchCRM is an open-source church management system. Prior to 7.1.0, critical 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 "$dbPassword" variable is not sanitized. This vulnerability exists due to an incomplete fix for CVE-2025-62521. This vulnerability is fixed in 7.1.0.
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.

References

Track CVEs across your fleet automatically

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

Get started free