MEDIUMCVSS v3.1 5.3Vulnerability

CVE-2026-118651

## Summary The Echo proxy middleware (`middleware/proxy.go`) preserves an incoming `X-Real-IP` header verbatim and forwards it to the upstream service when `Echo#IPExtractor` is not configured — which is the default. Because any HTTP client can supply an arbitrary `X-Real-IP` value, an attacker can cause Echo to relay a spoofed client IP address to every upstream service behind the proxy, undermining upstream IP-based access controls, rate limiting, audit logging, and geo-restriction. ## Affected Component - `middleware/proxy.go` — `ProxyConfig.ToMiddleware()`, header-rewriting block (lines 351–355) ## Description ### The header-preservation condition passes spoofed values to upstream `ProxyConfig.ToMiddleware()` (`proxy.go:338-405`) prepares forwarding headers before dispatching each request. The `X-Real-IP` rewrite logic at lines 351-355 reads: ```go // proxy.go:351-355 // Basically it's not good practice to unconditionally pass incoming x-real-ip header to upstream. // However, for backward compatibility, legacy behavior is preserved unless you configure Echo#IPExtractor. if req.Header.Get(echo.HeaderXRealIP) == "" || c.Echo().IPExtractor != nil { req.Header.Set(echo.HeaderXRealIP, c.RealIP()) } ``` The condition is `TRUE` (and therefore overwrites the header with a derived value) only when: - The header is absent — `req.Header.Get(echo.HeaderXRealIP) == ""`; **or** - `IPExtractor` is explicitly configured — `c.Echo().IPExtractor != nil` The condition is `FALSE` — and the header is left **unchanged** — when the request arrives with an `X-Real-IP` header already set **and** `IPExtractor` is `nil`. Because `Echo.New()` leaves `IPExtractor` as `nil`, this is the out-of-the-box behaviour for every application that uses `Proxy()` or `ProxyWithConfig()` without extra configuration. An attacker who sets `X-Real-IP` to any value causes Echo to forward exactly that value to the upstream, with no modification or validation. ### The comment in the source code

Properties

Severity
medium
Summary
Echo: Reverse Proxy Forwards Attacker-Supplied X-Real-IP to Upstream by Default
Nvd fetched at
2026-10-28T23:43:43.157973+00:00
Cvss severity
MEDIUM
Cvss score
5.3
Retrieved at
2026-10-28T23:45:49+00:00
Ghsa published
2026-10-28T19:53:24Z
Source url
https://github.com/advisories/GHSA-99jh-6h7p-pp36
Ghsa updated
2026-10-28T19:53:25Z
Ghsa id
GHSA-99jh-6h7p-pp36
Last source
GitHub Advisory Database
Score
5.3
Cvss version
3.1
Cve id
CVE-2026-118651
Cvss vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/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:N/S:U/C:N/I:L/A:N
Published at
2026-10-28T20:17:22.073
Last modified
2026-10-28T20:17:22.073

Related Entities (5)

VULNERABLE_TO (2)

HAS_WEAKNESS (1)

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-118651 (CVSS v3.1 5.3) — Ninja Signal Threat Intelligence | Ninja Signal