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.
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: php // 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: php $file->move(WRITEPATH . 'uploads', $file->getRandomName()); Or sanitize the client filename before passing it to move(): php helper('security');
$name = sanitizefilename($file->getClientName()); $file->move(WRITEPATH . 'uploads', $name);
Other sources
CodeIgniter is a PHP full-stack web framework. Prior to 4.7.4, calling UploadedFile::move() without a second argument uses the client-provided filename without sanitization, allowing a remote attacker to use path traversal sequences to write uploaded content outside the intended directory when the application exposes an upload path. This issue is fixed in version 4.7.4.
— MITRE
CodeIgniter: Path traversal in UploadedFile::move() when using client-provided filenames
— Packagist
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/codeigniter4/frameworkto a version that resolves this vulnerability.Fixed in 4.7.4 - Upgrade
Upgrade
CodeIgniter UploadedFileto a version that resolves this vulnerability.Fixed in 4.7.4 - Configuration
If calling UploadedFile::move(), do not pass a client-provided filename as the second argument unless you sanitize it first; alternatively, use a generated filename (not a client-provided one) or, after upgrading to 4.7.4, rely on the patched behavior when calling move() without a second argument.
UploadedFile::move() usage Second argument (destination filename) = Use a generated filename or call without a second argument only when you rely on patched sanitization
Event History
Frequently Asked Questions
What is the severity of CVE-2026-63222?
CVE-2026-63222 has a high severity rating of 7.5.
How do I fix CVE-2026-63222?
To fix CVE-2026-63222, upgrade CodeIgniter to version 4.7.4 or later.
What type of vulnerability is CVE-2026-63222?
CVE-2026-63222 is a path traversal vulnerability in CodeIgniter.
What can attackers achieve by exploiting CVE-2026-63222?
Exploiting CVE-2026-63222 allows remote attackers to write uploaded content outside the intended directory.
Which method in CodeIgniter is affected by CVE-2026-63222?
The vulnerability in CVE-2026-63222 affects the UploadedFile::move() method when using client-provided filenames.