All vulnerabilities

Go

CVE-2026-118652

Echo vulnerable to Reflected Cross-Site Scripting (XSS) via unsanitized JSONP callback in Context.JSONP / Context.JSONPBlob

Severity
Medium 6.1
Published
28 Oct 2026
Last changed
5 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
4.16.0, 5.4.0
Exploit chance
0.3% in the next 30 daysHigher than 21% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Cross-site scripting (CWE-79)
Attack
Over the network · No login needed · Needs someone to click or open something
Attacker can
Read some data · Change some data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Also known as
GHSA-h9g5-28mm-hx3g, GO-2026-6876
Sources
OSV.dev and GitHub

Description

The Context.JSONP, Context.JSONPBlob, and internal jsonPBlob helper in context.go directly concatenate the caller-supplied callback parameter into a JavaScript response without any validation, escaping, or allow-listing.

This creates a high-impact reflected XSS that can be triggered by any route passing attacker-controlled data (query string, form, header, path param, etc.) into the callback.

  • Session hijacking, cookie theft, account takeover, keylogging, defacement.
  • Works even with strict CSP (response is served as application/javascript).
From the GitHub Advisory Database, CC BY 4.0.

Workarounds

Manually sanitize the callback before calling JSONP/JSONPBlob:

Or migrate away from JSONP entirely (use CORS + application/json).

Validate the callback in your handler before calling Context.JSONP, for example against ^[A-Za-z_$][A-Za-z0-9_$](.[A-Za-z_$][A-Za-z0-9_$])*$, and set X-Content-Type-Options: nosniff. JSONP responses can be read by any website with the user's cookies, so do not serve data that requires authentication through JSONP.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
github.com/labstack/echo/v4Go · osv:Go:github.com/labstack/echo/v4
  • Every version before 4.16.0
github.com/labstack/echo/v5Go · osv:Go:github.com/labstack/echo/v5
  • Every version before 5.4.0

About github.com/labstack/echo/v4

About github.com/labstack/echo/v5

References