chi's RealIP Middleware allows IP spoofing via unvalidated X-Forwarded-For header
What to do
Partial vendor fix. Follow the primary source's mitigation guidance and check back for a fix.
This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.
Affected packages
Go github.com/go-chi/chi/v2/middleware
- Affected
- <= 2.1.1
- Fixed in
- no fixed version recorded
Go github.com/go-chi/chi/v3/middleware
- Affected
- <= 3.3.5
- Fixed in
- no fixed version recorded
Go github.com/go-chi/chi/v5/middleware
- Affected
- < 5.3.0
- Fixed in
- 5.3.0
Go github.com/go-chi/chi/v4/middleware
- Affected
- <= 4.1.3
- Fixed in
- no fixed version recorded
Go github.com/go-chi/chi/middleware
- Affected
- <= 1.5.5
- Fixed in
- no fixed version recorded
Sources
- GitHub Advisory Database and maintainer security advisories on GitHub
GitHub-reviewed advisory GHSA-rjr7-jggh-pgcp lists affected ranges: Go github.com/go-chi/chi/middleware >=0 =0 =0 =0 =0 <5.3.0
VerifiedObserved Structured GitHub Advisory Database record (type=reviewed) from the GitHub REST API.
Severity and exploitation
- Exploitation
- No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
- CVSS 4.0
- 7.7 · CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P · score source
- EPSS
- No dated EPSS signal available.
Source description
As published by the source; long descriptions are shortened.
Summary realip middleware in go-chi/chi trusts headers like x-forwarded-for without checking them, so attackers can fake their ip and bypass rate limits or access controls Details the vuln is in middleware/realip.go , the realIP() function pulls IPs straight from client headers and replaces r.RemoteAddr without checking if the request came from a trusted proxy no trusted proxy cidr check in place, any client can send these headers PoC create a server with chi and use realip middleware spoofed the ip to bypass access control Impact - ip-based access control bypass lets attackers reach restricted endpoints - rate limiting bypass lets attackers avoid limits by rotating spoofed ips - audit logs show fake ips picked by attacker instead of real ones - attackers can get around geo ip restrictions Remediation Recommendation validate proxy cidr first before trusting forwarded ip headers
Dates and revisions
- Published by the source
- Last modified by the source
- Source last checked
- Revision 1 · created ·
Published from ghsa record GHSA-rjr7-jggh-pgcp
Agent brief
Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.
# Patch Next advisory brief: GHSA-rjr7-jggh-pgcp Advisory: chi's RealIP Middleware allows IP spoofing via unvalidated X-Forwarded-For header IDs: GHSA-rjr7-jggh-pgcp Record: https://patchnext.com/advisories/ghsa-rjr7-jggh-pgcp (revision 1, source checked 26 Oct 2026, 15:24 UTC) Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected. Severity: High (CVSS 7.7) Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV. Vendor response: Partial vendor fix; fixed versions by package: github.com/go-chi/chi/v5/middleware 5.3.0. A vendor fix does not mean a deployment is fixed. ## Affected components - Go github.com/go-chi/chi/v2/middleware: affected <= 2.1.1 - Go github.com/go-chi/chi/v3/middleware: affected <= 3.3.5 - Go github.com/go-chi/chi/v5/middleware: affected < 5.3.0; fixed in 5.3.0 - Go github.com/go-chi/chi/v4/middleware: affected <= 4.1.3 - Go github.com/go-chi/chi/middleware: affected <= 1.5.5 ## Suggested inspection (read-only) - Go github.com/go-chi/chi/v2/middleware: check the installed version with your package manager. - Go github.com/go-chi/chi/v3/middleware: check the installed version with your package manager. - Go github.com/go-chi/chi/v5/middleware: check the installed version with your package manager. - Go github.com/go-chi/chi/v4/middleware: check the installed version with your package manager. - Go github.com/go-chi/chi/middleware: check the installed version with your package manager. ## Supported action No complete vendor fix is recorded. Follow the primary source's mitigation guidance and check this record again before closing anything. ## Required regression checks - Run the test suite and a production build. - Exercise the features that depend on github.com/go-chi/chi/v2/middleware, github.com/go-chi/chi/v3/middleware, github.com/go-chi/chi/v5/middleware, github.com/go-chi/chi/v4/middleware, github.com/go-chi/chi/middleware. - Repeat the inspection and confirm that only fixed versions remain installed. ## Rollback considerations - Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward. ## Unresolved questions - Which deployments run an affected version? - Exploitation status can change. Check again before lowering the priority. - Mark the work resolved only after the fixed version is verified in production. ## Sources - Verified: https://github.com/advisories/GHSA-rjr7-jggh-pgcp (GitHub-reviewed advisory GHSA-rjr7-jggh-pgcp lists affected ranges: Go github.com/go-chi/chi/middleware >=0 =0 =0 =0 =0 <5.3.0) Commands are suggestions: review each one before running it.
Loading voting…