CVE-2026-63222: CodeIgniter: Path traversal in UploadedFile::move() when using client-provided filenames
Impact In affected versions, calling UploadedFile::move() without a second argument uses the client-provided filename without sanitization. Depending on the destination path and server configuration, an attacker can supply a filename containing path traversal sequences (e.g. ../../public/shell.php) to write uploaded content outside the intended upload directory. The patch sanitizes this default (no-argument) path.
Published Aug 7, 2026
Affected packages
codeigniter4/framework
- Ecosystem
- Composer (PHP)
- Affected
- < 4.7.4
- Fixed in
- 4.7.4
- Check
composer show codeigniter4/framework
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
In affected versions, calling UploadedFile::move() without a second argument uses the client-provided filename without sanitization. Depending on the destination path and server configuration, an attacker can supply a filename containing path traversal sequences (e.g. ../../public/shell.php) to write uploaded content outside the intended upload directory.
The patch sanitizes this default (no-argument) path.
Note: The patch only sanitizes the filename when no second argument is passed. If your application explicitly passes a client-provided name as the second argument, you remain responsible for sanitizing it - the patch does not (and cannot) sanitize a caller-supplied filename:
// Unsafe - even after upgrading:
$file->move(WRITEPATH . 'uploads', $file->getName());
$file->move(WRITEPATH . 'uploads', $file->getClientName());Patches
Upgrade to v4.7.4 or later.
Workarounds
If you cannot upgrade immediately, use a generated filename or sanitize the client filename before passing it to move().
Use a generated filename:
$file->move(WRITEPATH . 'uploads', $file->getRandomName());Or sanitize the client filename before passing it to move():
helper('security');
$name = sanitize_filename($file->getClientName());
$file->move(WRITEPATH . 'uploads', $name);Credited to gr8man.
References
- https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-hhmc-q9hp-r662
- https://nvd.nist.gov/vuln/detail/CVE-2026-63222
- https://github.com/codeigniter4/CodeIgniter4/commit/20ebcf4694d96d3c97fbc3938e360730e4f54618
- https://github.com/codeigniter4/CodeIgniter4/releases/tag/v4.7.4
- https://github.com/advisories/GHSA-hhmc-q9hp-r662
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-63220
CodeIgniter: Spoofable forwarded HTTPS headers in IncomingRequest::isSecure()
medium4.8Aug 7, 2026CVE-2026-63221
CodeIgniter: SQL injection in Query Builder deleteBatch() when used with where() conditions
critical9.4Aug 7, 2026CVE-2026-63223
CodeIgniter: Uploaded file extension validation bypass in `is_image` and `mime_in` rules
critical9.8Aug 7, 2026CVE-2026-48062
CodeIgniter4 has a validation bypass when uploading file extensions via `ext_in` rule
critical9.8Jun 11, 2026CVE-2025-54418
CodeIgniter4's ImageMagick Handler has Command Injection Vulnerability
critical9.8Jul 28, 2025CVE-2025-24013
Missing validation of header name and value in codeigniter4/framework
medium5.3Jan 21, 2025
