{"id":"CVE-2026-42549","aliases":["GHSA-3xjv-pmf2-gf2q"],"url":"https://o3.security/vulnerability/CVE-2026-42549","summary":"Flight: Path traversal in `make:controller` CLI creates arbitrary directories outside project root","details":"### Summary\nThe `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.\n\n### Affected code\n`flight/commands/ControllerCommand.php` (≈ 63-66):\n\n```php\nif (is_dir(dirname($controllerPath)) === false) {\n    $io->info('Creating directory ' . dirname($controllerPath), true);\n    mkdir(dirname($controllerPath), 0755, true);   // un-normalized, runs before validation\n}\n```\n\n### Proof of concept\n```\n$ php vendor/flightphp/runway/runway make:controller '../../../../tmp/CONTROLLER_TRAVERSAL_TEST/pwn'\nCreating directory .../app/controllers/../../../../tmp/CONTROLLER_TRAVERSAL_TEST\nNette\\InvalidArgumentException: Value '../../../../tmp/CONTROLLER_TRAVERSAL_TEST/pwnController' is not valid class name.\n\n$ ls /home/user/tmp/CONTROLLER_TRAVERSAL_TEST\n(directory exists — created before the exception was thrown)\n```\n\n### Impact\n- **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).\n- Primes log-file planting for chained LFI exploitation (e.g. creating a directory where an attacker can later drop a `.php` file to be included via a distinct template-include weakness).\n- On Windows, the `\\` separator opens additional traversal surface.\n\n### Patch (fixed in `3.18.1`, commit `b8dd23a`)\nThe controller name is now normalized with `basename()` and validated against `^[A-Za-z_][A-Za-z0-9_]*$` before any `mkdir` side effect runs.\n\n### Credit\nDiscovered by **@Rootingg**.","published":"2026-05-13T19:22:20.932Z","modified":"2026-08-12T03:51:31.319903876Z","cvss":{"score":4.4,"severity":"MEDIUM","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L"},"epss":{"score":0.00154,"percentile":0.0508,"asOf":"2026-08-13"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"Packagist","name":"flightphp/core","fixedVersion":"3.18.1"}],"fix":null,"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42549.json"},{"type":"ADVISORY","url":"https://github.com/flightphp/core/security/advisories/GHSA-3xjv-pmf2-gf2q"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42549"},{"type":"PACKAGE","url":"https://github.com/flightphp/core"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:31.319903876Z"}}