Skip to main content
VulnerabilityPublished Updated

`middleware.RealIP` · Chi Has an IP Spoofing Vulnerability

Affects github.com/go-chi/chi/v5/middlewareSource GCVE Database

0

CVSS 6.9 Medium : upgrade to 5.3.0 when convenient.

Data as of 4 Nov 2026, 04:16 UTC

CVSS 4.0 base score
6.9Medium
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 5.3.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

What to do

Upgrade github.com/go-chi/chi/v5/middleware and github.com/go-chi/chi/v5 to 5.3.0.

Affected software

ProductAffectedFixed in
Gogithub.com/go-chi/chi/v5/middlewareAffected
  • >=5.2.1 <5.3.0
Fixed in
  • 5.3.0
Gogithub.com/go-chi/chi/v5Affected
  • >=5.2.1 <5.3.0
Fixed in
  • 5.3.0

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

A fix is available in version 5.3.0 of go-chi/chi middleware. Users should upgrade to this version or later. Until then, avoid using middleware.RealIP unless incoming headers are sanitized by trusted proxies. Implement IP extraction that verifies trusted proxy chains and parses X-Forwarded-For from right to left, stopping at the first untrusted IP.

Description

The go-chi/chi v5 middleware RealIP is vulnerable to IP spoofing because it trusts the first IP in the X-Forwarded-For header without verifying the proxy chain. This allows attackers to bypass IP-based access controls and rate limiting by spoofing their IP address. The vulnerability affects versions up to v5.2.1 and is fixed in v5.3.0.

References

Community reviews

Loading reviews…