GitHub Advisoryadvisory · Packagist
GHSA-hhmc-q9hp-r662 CodeIgniter: Path traversal in UploadedFile::move() when using client-provided filenames
HIGH
Official page ↗
- Aliases
- CVE-2026-63222
- Ecosystem
- Packagist
- Packages
- codeigniter4/framework
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
- Weaknesses
- CWE-22
- Reviewed
- 2026-08-07
Affected packages
• Packagist codeigniter4/framework: < 4.7.4 → fixed in 4.7.4
Description
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 = sanitize_filename($file->getClientName());
$file->move(WRITEPATH . 'uploads', $name);
```
Related
Alias · CVE (1)
- CVE-2026-63222 CodeIgniter is a PHP full-stack web framework. vulnerability
Weakness · CWE (1)
- CWE-22 Improper Limitation of a Pathname to a Restricted Directory weakness
References
- https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-hhmc-q9hp-r662 web
- https://nvd.nist.gov/vuln/detail/CVE-2026-63222 advisory
- https://github.com/codeigniter4/CodeIgniter4/commit/20ebcf4694d96d3c97fbc3938e360730e4f54618 web
- https://github.com/codeigniter4/CodeIgniter4 package
- https://github.com/codeigniter4/CodeIgniter4/releases/tag/v4.7.4 web