CVE-2025-54418: CodeIgniter4 ImageMagick Handler Command Injection Vulnerability

codeigniter4/framework Updated 02 Oct 2025

Summary

28/07/2025
Yes i
Critical
9.8

CVE-2025-54418: CodeIgniter4's ImageMagick Handler has Command Injection Vulnerability. Affects codeigniter4/framework versions < 4.6.2. Fixed in 4.6.2. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

CodeIgniter4 is a powerful PHP framework designed for building web applications. It offers a rich set of libraries and tools for developers, including support for various image processing libraries. However, its ImageMagick handler, when used with user-controlled inputs, is vulnerable to command injection attacks, allowing malicious users to execute arbitrary commands on the server.

Vulnerability Detail

This vulnerability arises from the improper handling of user-controlled filenames and text inputs when using the ImageMagick handler for image processing. Attackers can exploit this by uploading files with malicious filenames containing shell metacharacters or by providing harmful text content that gets executed during image processing. The potential ramifications include unauthorized command execution, leading to data breaches or server compromise.

How To Fix

Minimum fixed version

4.6.2

This is the first release that contains the fix.

composer require codeigniter4/framework:4.6.2

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately feasible, consider the following workarounds: 1. Switch to the GD image handler (the default handler) which is not affected by this vulnerability. 2. For file uploads, generate random filenames using the 'getRandomName()' method when using the 'move()' method, or utilize the 'store()' method which automatically generates safe filenames. 3. For text operations, sanitize user input by allowing only safe characters using the following code: 'preg_replace('/[^a-zA-Z0-9\s.,!?-]/', '', $text)'. Validate and restrict text options accordingly.

Conclusion

The CodeIgniter4 ImageMagick handler vulnerability (CVE-2025-54418) poses a significant risk to applications that allow user-controlled inputs for image processing. It is crucial to upgrade to the patched version (4.6.2 or later) or implement the recommended workarounds to safeguard your application against potential attacks.

See every vulnerability recorded for codeigniter4/framework →

Share this vulnerability

FAQ

CVE-2025-54418 is a critical vulnerability in CodeIgniter4's ImageMagick handler that allows for command injection through user-controlled inputs.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Check your application against this vulnerability using the Vulert playground at Vulert Scanner.

If exploited, this vulnerability can lead to unauthorized command execution on the server, potentially compromising sensitive data and the integrity of the application.

Implement the suggested workarounds, such as switching to the GD image handler or sanitizing user inputs to mitigate the risk until you can upgrade.

The CVSS score for this vulnerability is 9.8, indicating a critical level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for codeigniter4/framework.

How To Fix

Minimum fixed version

4.6.2

This is the first release that contains the fix.

composer require codeigniter4/framework:4.6.2

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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