4.4medium
Flight: Path traversal in `make:controller` CLI creates arbitrary directories outside project root
- Severity
- 4.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.16% (higher than 2% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-3xjv-pmf2-gf2q
Description
Flight is an extensible micro-framework for PHP. Prior to 3.18.1, the make:controller CLI command calls mkdir(..., recursive: true) on a path built from the user-supplied controller name, before Nette's class-name validation runs. The class-file write is correctly rejected by Nette when the name contains /, but the recursive directory creation side effect is already committed — including directories located outside the project root through ../ traversal. This vulnerability is fixed in 3.18.1.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| flightphp core | < 3.18.1 | CVE List |
| flightphp/core (Packagist) | before 3.18.1 | GitHub Advisory Database |
All scores
| GitHub_M | 4.4medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L |
| GitHub | 4.4medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
Flight is an extensible micro-framework for PHP. Prior to 3.18.1, the make:controller CLI command calls mkdir(..., recursive: true) on a path built from the user-supplied controller name, before Nette's class-name validation runs. The class-file write is correctly rejected by Nette when the name contains /, but the recursive directory creation side effect is already committed — including directories located outside the project root through ../ traversal. This vulnerability is fixed in 3.18.1.
GitHub Advisory Database
Summary
The make:controller CLI command calls mkdir(..., recursive: true) on a path built from the user-supplied controller name, before Nette's class-name validation runs. The class-file write is correctly rejected by Nette when the name contains /, but the recursive directory creation side effect is already committed — including directories located outside the project root through ../ traversal.
Affected code
flight/commands/ControllerCommand.php (≈ 63-66):
if (is_dir(dirname($controllerPath)) === false) {
$io->info('Creating directory ' . dirname($controllerPath), true);
mkdir(dirname($controllerPath), 0755, true); // un-normalized, runs before validation
}
Proof of concept
$ php vendor/flightphp/runway/runway make:controller '../../../../tmp/CONTROLLER_TRAVERSAL_TEST/pwn'
Creating directory .../app/controllers/../../../../tmp/CONTROLLER_TRAVERSAL_TEST
Nette\InvalidArgumentException: Value '../../../../tmp/CONTROLLER_TRAVERSAL_TEST/pwnController' is not valid class name.
$ ls /home/user/tmp/CONTROLLER_TRAVERSAL_TEST
(directory exists — created before the exception was thrown)
Impact
- Arbitrary directory creation outside the project root, executable by any local actor that can run the Flight CLI (developer machine, shared CI build agent, compromised dev container).
- Primes log-file planting for chained LFI exploitation (e.g. creating a directory where an attacker can later drop a
.phpfile to be included via a distinct template-include weakness). - On Windows, the
\separator opens additional traversal surface.
Patch (fixed in 3.18.1, commit b8dd23a)
The controller name is now normalized with basename() and validated against ^[A-Za-z_][A-Za-z0-9_]*$ before any mkdir side effect runs.
Credit
Discovered by @Rootingg.
NVD (es)
Flight es un micro-framework extensible para PHP. Antes de 3.18.1, el comando CLI make:controller llama a mkdir(..., recursive: true) en una ruta construida a partir del nombre de controlador proporcionado por el usuario, antes de que se ejecute la validación de nombres de clase de Nette. La escritura del archivo de clase es correctamente rechazada por Nette cuando el nombre contiene /, pero el efecto secundario de creación recursiva de directorios ya está comprometido - incluyendo directorios ubicados fuera de la raíz del proyecto a través del recorrido .. / . Esta vulnerabilidad está corregida en 3.18.1.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-42549 changed 2026-05-14 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-3xjv-pmf2-gf2q changed 2026-05-14 | CC-BY-4.0 |
| NVD | CVE-2026-42549 changed 2026-10-26 | Public domain |