MEDIUMCVSS v3.1 5.9Vulnerability

CVE-2026-118657

## Description `Context.Scheme()` unconditionally trusts four client-controlled HTTP headers to determine the request scheme, with no mechanism to configure trusted sources. This allows a remote unauthenticated attacker to bypass HTTPS redirect enforcement and suppress HSTS headers. The trusted headers (checked in this order of precedence): 1. `X-Forwarded-Proto` 2. `X-Forwarded-Protocol` 3. `X-Forwarded-Ssl` 4. `X-Url-Scheme` ### Threat model **Scenario A — Directly exposed application (vulnerable by default):** The Echo application listens on HTTP and is reachable directly by clients (no L7 proxy in front), or an attacker can bypass the proxy and reach the backend directly. In this case, the attacker has full control over all request headers. Sending `X-Forwarded-Proto: https` defeats the `HTTPSRedirect` middleware entirely — traffic stays on plaintext HTTP, enabling man-in-the-middle attacks. This is the primary scenario. The application is vulnerable by default with no misconfiguration required — simply using `e.Pre(middleware.HTTPSRedirect())` as documented is sufficient. **Scenario B — Behind L7 proxy with header sanitization (reduced risk):** If the application is strictly behind a correctly configured L7 proxy that always overwrites `X-Forwarded-Proto` and there is no direct access to the backend, the practical risk is lower. However, this relies on perimeter controls external to the framework, not on the framework itself. As Echo's own IP-extraction documentation states: *"you must not trust HTTP headers unconditionally."* ### Root cause `context.go`, lines 161–181: ```go func (c *Context) Scheme() string { if c.IsTLS() { return "https" } if scheme := c.request.Header.Get(HeaderXForwardedProto); scheme != "" { return scheme } if scheme := c.request.Header.Get(HeaderXForwardedProtocol); scheme != "" { return scheme } if ssl := c.request.Header.Get(HeaderXForwardedSsl); ssl == "on" { return

Properties

Severity
medium
Summary
Echo: HTTPS Redirect and HSTS Bypass via Unconditional Trust of Forwarded Scheme Headers
Nvd fetched at
2026-10-28T23:43:43.157973+00:00
Cvss severity
MEDIUM
Cvss score
5.9
Retrieved at
2026-10-28T23:45:49+00:00
Ghsa published
2026-10-28T21:04:52Z
Source url
https://github.com/advisories/GHSA-2ffq-g2xg-c22p
Ghsa updated
2026-10-28T21:04:53Z
Ghsa id
GHSA-2ffq-g2xg-c22p
Last source
GitHub Advisory Database
Score
5.9
Cvss version
3.1
Cve id
CVE-2026-118657
Cvss vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/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:H/PR:N/UI:R/S:U/C:H/I:L/A:N
Published at
2026-10-28T21:16:55.693
Last modified
2026-10-28T21:16:55.693

Related Entities (5)

VULNERABLE_TO (2)

HAS_WEAKNESS (1)

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-118657 (CVSS v3.1 5.9) — Ninja Signal Threat Intelligence | Ninja Signal