The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2025-54418

CVE-2025-54418: CodeIgniter ImageMagick RCE Vulnerability

CVE-2025-54418 is a command injection RCE flaw in CodeIgniter's ImageMagick handler that allows attackers to execute arbitrary commands via malicious filenames or text content. This article covers technical details, affected versions, impact, and mitigation strategies.

Published: March 11, 2026

CVE-2025-54418 Overview

CVE-2025-54418 is a critical command injection vulnerability affecting CodeIgniter, a PHP full-stack web framework. The vulnerability exists in the ImageMagick handler for image processing and impacts applications that use imagick as their image library. Exploitation occurs when applications allow file uploads with user-controlled filenames and process those images using the resize() method, or when using 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. Alternatively, attackers can provide malicious text content or options that get executed when adding text to images. This command injection vulnerability allows for arbitrary command execution on the underlying server, potentially leading to complete system compromise.

Critical Impact

Unauthenticated remote attackers can execute arbitrary system commands on vulnerable CodeIgniter applications using the ImageMagick handler, potentially leading to full server compromise, data exfiltration, and lateral movement within the network.

Affected Products

  • CodeIgniter versions prior to 4.6.2
  • Applications using imagick as the image library handler
  • Systems processing user-uploaded images via the resize() method or using text() with user-controlled input

Discovery Timeline

  • 2025-07-28 - CVE-2025-54418 published to NVD
  • 2025-08-05 - Last updated in NVD database

Technical Details for CVE-2025-54418

Vulnerability Analysis

This command injection vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command. The vulnerability stems from improper input sanitization in the ImageMagickHandler.php file, where user-controlled filenames and parameters are passed directly to shell commands without proper escaping.

The attack can be executed remotely over the network without requiring any authentication or user interaction. When exploited, an attacker gains the ability to execute arbitrary commands with the privileges of the web server process, potentially leading to complete confidentiality, integrity, and availability compromise of the affected system.

Root Cause

The root cause of CVE-2025-54418 lies in the ImageMagickHandler.php file where source and destination file paths were concatenated directly into shell commands using string interpolation with double quotes. The vulnerable code constructed the ImageMagick resize command by wrapping file paths in escaped double quotes (\") rather than using PHP's escapeshellarg() function to properly sanitize shell metacharacters.

This allowed attackers to inject arbitrary shell commands through specially crafted filenames containing metacharacters such as backticks, semicolons, or command substitution sequences that break out of the quoted context and execute additional commands.

Attack Vector

The attack vector for CVE-2025-54418 is network-based and requires no authentication. An attacker can exploit this vulnerability through the following attack path:

  1. Identify a CodeIgniter application using the ImageMagick handler (imagick) for image processing
  2. Upload a file with a malicious filename containing shell metacharacters (e.g., image$(whoami).jpg or image\id`.png`)
  3. Trigger the image processing functionality that calls the resize() method
  4. The shell metacharacters in the filename are executed as system commands

Alternatively, if the application uses the text() method with user-controlled input, attackers can inject commands through the text content or options parameters.

The following patch demonstrates how the vulnerability was fixed by implementing proper shell argument escaping:

php
         }
 
         $action = $maintainRatio
-            ? ' -resize ' . ($this->width ?? 0) . 'x' . ($this->height ?? 0) . ' "' . $source . '" "' . $destination . '"'
-            : ' -resize ' . ($this->width ?? 0) . 'x' . ($this->height ?? 0) . "{$escape}! \"" . $source . '" "' . $destination . '"';
+            ? ' -resize ' . ($this->width ?? 0) . 'x' . ($this->height ?? 0) . ' ' . escapeshellarg($source) . ' ' . escapeshellarg($destination)
+            : ' -resize ' . ($this->width ?? 0) . 'x' . ($this->height ?? 0) . "{$escape}! " . escapeshellarg($source) . ' ' . escapeshellarg($destination);
 
         $this->process($action);

Source: GitHub CodeIgniter4 Commit

The fix replaces the vulnerable string concatenation with double quotes to use escapeshellarg(), which properly escapes all shell metacharacters in the source and destination file paths.

Detection Methods for CVE-2025-54418

Indicators of Compromise

  • Unusual process spawning from web server processes (e.g., www-data or apache user executing shell commands)
  • Image filenames containing shell metacharacters such as backticks, $(), semicolons, or pipe characters in upload directories
  • Web server error logs showing ImageMagick command execution failures or unexpected command output
  • Unexpected outbound network connections from the web server process
  • Newly created files or modified system configurations without administrative action

Detection Strategies

  • Monitor web application upload directories for filenames containing shell metacharacters ($, backticks, ;, |, &)
  • Implement file integrity monitoring on CodeIgniter application directories to detect unauthorized modifications
  • Deploy web application firewalls (WAF) with rules to detect command injection patterns in file upload requests
  • Analyze HTTP request logs for suspicious filename patterns in file upload endpoints
  • Configure process monitoring to alert on unusual child processes spawned by PHP/web server processes

Monitoring Recommendations

  • Enable detailed logging for file upload operations including original and sanitized filenames
  • Configure SIEM rules to correlate image processing operations with subsequent command execution events
  • Implement real-time alerting for ImageMagick process invocations with unexpected command-line arguments
  • Monitor for reconnaissance commands commonly executed post-exploitation (e.g., whoami, id, uname)

How to Mitigate CVE-2025-54418

Immediate Actions Required

  • Upgrade CodeIgniter to version 4.6.2 or later immediately
  • If immediate upgrade is not possible, switch to the GD image handler (gd) which is not affected by this vulnerability
  • Audit all file upload functionality to ensure user-provided filenames are not used directly
  • Review and sanitize any user-controlled input passed to the text() method

Patch Information

CodeIgniter has released version 4.6.2 which addresses this command injection vulnerability. The patch implements proper shell argument escaping using PHP's escapeshellarg() function for all user-controlled values passed to ImageMagick commands.

Users should upgrade to version 4.6.2 or later to receive the security fix. The patch is available in the GitHub CodeIgniter4 Commit. For complete details, refer to the GitHub Security Advisory GHSA-9952.

Workarounds

  • Switch to the GD image handler (gd, the default handler) which is not affected by this vulnerability
  • For file upload scenarios, use getRandomName() with the move() method to generate safe random filenames instead of user-provided names
  • Use the store() method which automatically generates safe filenames for uploaded files
  • For text operations requiring ImageMagick with user-controlled text, implement strict input sanitization allowing only safe characters
  • Validate and restrict text options to a predefined whitelist of safe values
bash
# Configuration example - Switch to GD handler in app/Config/Images.php
# Change the default handler from 'imagick' to 'gd'
public string $defaultHandler = 'gd';

# For file uploads, use getRandomName() instead of user filename
$file->move(WRITEPATH . 'uploads', $file->getRandomName());

# Or use store() which auto-generates safe filenames
$file->store();

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechCodeigniter

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.50%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-78
  • Technical References
  • MITRE CWE Definition #78

  • OWASP Command Injection Overview
  • Vendor Resources
  • GitHub CodeIgniter4 Commit

  • GitHub Security Advisory GHSA-9952
  • Related CVEs
  • CVE-2022-24711: CodeIgniter4 RCE Vulnerability

  • CVE-2022-21647: CodeIgniter RCE Vulnerability

  • CVE-2026-34572: CI4MS Authentication Bypass Vulnerability

  • CVE-2026-34560: CI4MS CodeIgniter CMS XSS Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English