CVE-2026-142152 in CodeIgniter4
Summary
by MITRE • 12/02/2026
CodeIgniter4 before 4.7.5 contains a file upload validation bypass in FileRules that allows remote attackers to evade type, extension, size, and dimension checks. Attackers can place an empty UPLOAD_ERR_NO_FILE entry before a disallowed file in an optional multiple-file upload to get it accepted, potentially enabling code execution where uploads are web-accessible.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 12/02/2026
The vulnerability identified in CodeIgniter4 versions prior to 4.7.5 represents a critical flaw within the framework's FileRules component, specifically affecting the validation logic for file uploads. This security issue stems from an improper handling of multiple-file upload scenarios where optional fields are processed. The core technical deficiency lies in how the application iterates through and validates uploaded files when more than one file is submitted simultaneously. By exploiting this logic error, a remote attacker can manipulate the order or structure of the upload data to bypass critical security checks designed to restrict file types, extensions, sizes, and dimensions.
The exploitation mechanism relies on inserting an empty UPLOAD_ERR_NO_FILE entry before a disallowed file within the multipart form data payload. In PHP-based applications handling multiple uploads, errors are often indexed by the input field name or array index. When the validation routine encounters this artificial error code indicating no file was uploaded at that specific index, it may skip further processing for subsequent entries in the same batch due to flawed loop logic or conditional checks. This allows a maliciously crafted file with an unauthorized extension or type to slip through the validation filters undetected because the presence of the preceding empty entry disrupts the expected sequence of validation steps.
This bypass has severe operational implications, particularly in environments where uploaded files are stored in web-accessible directories. If successful, attackers can upload executable scripts such as PHP shells directly onto the server's document root or other accessible paths. Once these malicious files are hosted on a publicly reachable URL, they enable remote code execution (RCE), granting the attacker full control over the underlying application and potentially the entire server infrastructure. This scenario aligns with CWE-434, which describes the unrestricted upload of file types that can lead to arbitrary code execution, as well as CWE-20 regarding improper input validation where specific constraints are not rigorously enforced across all inputs in a batch process.
From an offensive security perspective, this vulnerability maps directly to MITRE ATT&CK technique T1505.003, known as Web Shell: ASPX, PHP, JSP, or CGI, which falls under the broader category of Server-Side Scripting (T1505). The attacker leverages the upload bypass to establish a persistent foothold within the web application environment, facilitating further lateral movement and data exfiltration. It is also relevant to CWE-798, concerning the use of hardcoded credentials or default configurations that might exacerbate the impact if combined with other misconfigurations, though here the primary issue remains the validation logic itself rather than credential management.
To mitigate this vulnerability, organizations must immediately upgrade CodeIgniter4 to version 4.7.5 or later, where the FileRules component has been patched to correctly handle multiple-file uploads and validate each file independently regardless of preceding entries in the batch. Additionally, developers should implement defense-in-depth strategies by enforcing strict allowlists for permitted file extensions rather than relying solely on MIME type detection, which can be spoofed. It is also crucial to store uploaded files outside of web-accessible directories or configure the web server to deny execution permissions for upload folders. Regular security audits and static code analysis tools should be employed to detect similar validation bypass patterns in custom application logic before deployment.