`middleware.RealIP` · Chi Has an IP Spoofing Vulnerability
Affects github.com/go-chi/chi/v5/middlewareSource GCVE Database
CVSS 6.9 Medium : upgrade to 5.3.0 when convenient.
Data as of 4 Nov 2026, 04:16 UTC
- 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:NWhat to do
Upgrade github.com/go-chi/chi/v5/middleware and github.com/go-chi/chi/v5 to 5.3.0.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| Gogithub.com/go-chi/chi/v5/middleware | Affected
| Fixed in
|
| Gogithub.com/go-chi/chi/v5 | Affected
| Fixed in
|
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.