MediumGHSA-h53f-rm2w-w7rgCVE-2026-118265GO-2026-6841

Echo: X-Real-IP extractor trusts the header value instead of the sending peer

Published 23 Oct 2026 · Updated 5 Nov 2026

Is your project on an affected github.com/labstack/echo/v5?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
>=5.0.0 <5.4.1
Fixed in
5.4.1
Update to the fixed version for your release line, for example:go get github.com/labstack/echo/v5@v5.4.1

Details

Impact

In Echo v5, ExtractIPFromRealIPHeader checked whether the address supplied in X-Real-IP belonged to a trusted range instead of checking the address of the direct network peer. An untrusted client could therefore supply a loopback or private address and have it returned by c.RealIP() with the extractor's default trust options.

Applications using this extractor for IP allowlists, IP-based rate limiting, audit logs or forwarding headers could accept a spoofed client identity. Exploitation requires that the attacker can reach Echo directly or that an intervening proxy passes through the attacker's X-Real-IP value. Applications using the default direct IP extractor are unaffected. Echo v4 is unaffected by this v5 regression.

Affected versions and patch

All v5 releases from v5.0.0 through v5.4.0 are affected. Upgrade to v5.4.1.

The patch validates the direct peer before accepting a syntactically valid X-Real-IP value, restoring the v4 trust model. Fix commit.

Workarounds

Use ExtractIPDirect until upgrading, or ensure that only trusted proxies can reach Echo and that they replace client-supplied forwarding headers. Configure trusted proxy ranges narrowly for the deployment.

Credits

Reported and patched by @rm-Umar. @Duodum independently reported the same issue in GHSA-c3r7-8j36-7mx8, which is tracked as a duplicate of this advisory.

Is GHSA-h53f-rm2w-w7rg in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected github.com/labstack/echo/v5, and gives you the command that fixes it.

More advisories for github.com/labstack/echo/v5

  • LowCVE-2026-118653Rate Limiter Bypass via Spoofed X-Forwarded-For Header in Default Configuration in github.com/labstack/echo · 5 Nov 2026
  • LowCVE-2026-118650URL-encoded path bypasses route/group middleware guarding a statically-served path in github.com/labstack/echo · 5 Nov 2026
  • LowCVE-2026-118651Reverse Proxy Forwards Attacker-Supplied X-Real-IP to Upstream by Default in github.com/labstack/echo · 5 Nov 2026
  • LowCVE-2026-118652Cross-Site Scripting (XSS) via unsanitized JSONP callback in github.com/labstack/echo · 5 Nov 2026
  • LowCVE-2026-118266Echo has CSRF Protection Bypass via MethodOverride Rewriting POST to Safe Method in github.com/labstack/echo · 5 Nov 2026
  • LowCVE-2026-118658Arbitrary Scheme Injection in WWWRedirect/NonWWWRedirect Middlewares via X-Forwarded-Proto in github.com/labstack/echo · 5 Nov 2026
All 31 advisories for github.com/labstack/echo/v5

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.