/

CVE-2026-48062

Severity:

CRITICAL RISK

(9.8)

Arbitrary File Upload (CWE-434) in CodeIgniter ext_in

CVE-2026-48062

Deferred

Vulnerability type

Category:

Arbitrary File Upload / Unrestricted File Upload

CWE:

CWE-434

Impact:

Remote Code Execution via Unrestricted File Upload

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A file upload validation flaw in CodeIgniter's ext_in rule can allow files with dangerous extensions, such as .php, to bypass extension checks when their MIME-derived extension appears benign.

When applications save uploads using the original client filename into web-accessible directories, this behavior may enable arbitrary code execution via uploaded server-side scripts.

Affected context

This vulnerability appears in CodeIgniter-based applications that accept user-controlled file uploads and rely on the ext_in validation rule to enforce safe file extensions.

It becomes relevant when applications:

  • Combine rules like uploaded, is_image, mime_in, and ext_in for validation
  • Save the uploaded file using the original client-provided filename via constructs like $file->move($path)
  • Store uploaded files in web-accessible directories
  • Permit execution of PHP or other server-side scripts from those directories

Under these conditions, a file whose content suggests a safe type but whose extension is dangerous may still be accepted and executed.

Exploit preconditions

  • Attack surface: Public or internal upload endpoints that accept user-supplied files (e.g., avatar, media, document uploads).
  • Required access: Ability to submit files through the application's upload mechanism; no direct server access is required.
  • Trigger point: The upload validation pipeline when ext_in is used, and the file is later saved with its original client filename in a web-accessible, executable directory.
  • Why exploitation is possible: The ext_in rule checks the MIME-derived guessed extension instead of the client-supplied filename extension, allowing a mismatch where a script file (e.g., shell.php) with image-like content is treated as a safe extension and stored where it can be executed.

Why this happens

The underlying bug is a validation logic error in the file upload rules implementation.

Rather than validating the actual client-provided filename extension, the ext_in rule relies on the MIME-based guessed extension derived from file content.

This maps to CWE-434: Unrestricted Upload of File with Dangerous Type, because the system fails to adequately constrain which file types and extensions may be uploaded, allowing dangerous script files to bypass extension restrictions when their content mimics benign formats.

Abstractly, the pattern is: validation tied to inferred content type instead of the true naming/extension attributes used at storage time, resulting in a trust gap between checks and the final persisted artifact.

Potential impact

  • Remote execution of arbitrary PHP code on the server via uploaded script files
  • Full compromise of the affected web application's runtime environment
  • Unauthorized access to sensitive data stored or processed by the application
  • Lateral movement to other services or systems reachable from the compromised server
  • Defacement or malicious content hosting through the application's upload directories

General mitigation guidance

Effective mitigation focuses on aligning validation with how uploaded files are stored and executed, while reducing trust in user-controlled attributes.

Common defensive patterns include:

  • Validating both MIME type and the actual client filename extension, and rejecting uploads where they do not match a strict allowlist.
  • Normalizing uploaded filenames (e.g., generating server-side names) instead of using client-supplied names, so user-controlled extensions are never used directly.
  • Storing uploads outside of web-accessible or executable directories, serving them via indirect handlers rather than direct URL access.
  • Ensuring that directories used for uploads are configured to disallow execution of server-side scripts (e.g., PHP, CGI).
  • Applying least-privilege principles to the web server and application so that even if a file is misclassified, it cannot easily escalate impact.

How teams detect issues like this

Organizations can detect this class of issue by examining both code and deployment configurations:

  • Static analysis or code review to identify reliance on ext_in (or similar extension-based rules) that use inferred MIME-derived extensions rather than the actual client filename extension.
  • Review of upload handling logic to flag workflows where user filenames are reused directly when persisting files, especially into web-accessible paths.
  • Configuration audits of upload directories to ensure script execution is disabled and file-type restrictions are enforced at the web server level.
  • Policy-based enforcement in CI/CD requiring that upload endpoints use strict allowlists, filename normalization, and non-executable storage locations.
  • Optional use of automated security scanners or SAST tools tuned to detect unrestricted file upload patterns and mismatches between validation and storage behavior.

Sources

SourceLink
github.comgithub.com/codeigniter4/CodeIgniter4/commit/29299349e7d232e9532767c7cefaed30957309be
github.comgithub.com/codeigniter4/CodeIgniter4/releases/tag/v4.7.3
github.comgithub.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-2gr4-ppc7-7mhx

Frequently asked

questions

It can be exploitable remotely when the application exposes an upload endpoint to untrusted users and stores uploaded files in a web-accessible, executable directory. If uploads are not publicly reachable or execution is disabled, the practical exploitability is reduced.

An attacker generally only needs the ability to use the file upload feature as a normal user. No special server privileges are required, though application-specific authentication requirements may apply.

The safest pattern is to treat user-uploaded files as untrusted content: validate using strict allowlists against both MIME type and real filename extension, normalize filenames on the server, store uploads in non-executable locations, and prevent direct script execution from upload directories.

Future designs should separate storage and execution concerns, avoid using client-supplied filenames, enforce strong validation and sanitization of all upload metadata, and complement application-level checks with web server rules that block script execution from upload paths.

Find out what's already
exploitable in your codebase.