All vulnerabilities

Go

CVE-2026-118653

Echo has Rate Limiter Bypass via Spoofed X-Forwarded-For Header in Default Configuration

Severity
Medium 5.3
Published
28 Oct 2026
Last changed
5 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
5.1.0
Exploit chance
0.5% in the next 30 daysHigher than 43% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Authentication bypass by spoofing (CWE-290)
Attack
Over the network · No login needed · No user action needed
Attacker can
Change some data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Also known as
GHSA-246p-cpwv-v3jq, GO-2026-6872
Sources
OSV.dev and GitHub

Description

When echo.New() is used without explicitly setting Echo#IPExtractor, the RealIP() method falls back to reading the client-supplied X-Forwarded-For (or X-Real-IP) header without any proxy-origin validation. The default RateLimiter() middleware derives its per-client identifier from ctx.RealIP(), so an attacker can rotate arbitrary values in the X-Forwarded-For header on each request to obtain a fresh rate-limit bucket and bypass IP-based throttling entirely.

Context.RealIP() (context.go:186-208) first checks c.echo.IPExtractor. When this field is nil (the default for echo.New()), it falls through to legacy behavior and returns the first IP from the X-Forwarded-For header — the position an attacker has full control over:

DefaultRateLimiterConfig (rate_limiter.go:46-58) sets the identifier extractor to ctx.RealIP() with no guard for whether a safe IPExtractor is configured:

RateLimiter(store) (rate_limiter.go:71-76) copies DefaultRateLimiterConfig directly:

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

Configure Echo#IPExtractor for your deployment (echo.ExtractIPDirect() without a proxy, echo.ExtractIPFromXFFHeader() behind proxies, with TrustIPRange for proxies on public addresses), or set RateLimiterConfig.IdentifierExtractor to an identifier that clients cannot choose.

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
  • From 4.0.0 up to 4.16.2
github.com/labstack/echo/v5Go · osv:Go:github.com/labstack/echo/v5
  • Every version before 5.1.0

About github.com/labstack/echo/v4

About github.com/labstack/echo/v5

References