{"id":"CVE-2026-42549","aliases":["CVE-2026-42549","GHSA-3xjv-pmf2-gf2q"],"related":[],"kind":"vulnerability","state":"published","title":"Flight: Path traversal in `make:controller` CLI creates arbitrary directories outside project root","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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**.","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-05-06T21:34:39.000Z","modified":"2026-10-26T14:10:00.130Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L","score":4.4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L","score":4.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L","score":4.4,"rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 3.18.1","status":"affected"}],"vendor":"flightphp","product":"core","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.18.1"}],"ecosystem":"Packagist","package":"flightphp/core","purl":"pkg:composer/flightphp/core","source":"ghsa"}],"references":[{"url":"https://github.com/flightphp/core/security/advisories/GHSA-3xjv-pmf2-gf2q","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42549","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/flightphp/core","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-05-14T19:05:05.835Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42549","url":"https://www.cve.org/CVERecord?id=CVE-2026-42549","licence":"CVE Terms of Use","modified":"2026-05-14T19:52:29.945Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3xjv-pmf2-gf2q","url":"https://github.com/advisories/GHSA-3xjv-pmf2-gf2q","licence":"CC-BY-4.0","modified":"2026-05-14T20:48:36.195Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42549","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42549","licence":"Public domain","modified":"2026-10-26T14:10:00.130Z"}],"updatedAt":"2026-11-25T22:59:21.656Z","epss":{"score":0.00156,"percentile":0.02485,"date":"2026-11-30T12:00:22.000Z"}}