chi Middleware Vulnerable to Potential IP Spoofing via X-Forwarded-For Header in Request.RemoteAddr Resolution
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
- >= 0.9.0, <= 1.5.5
- Fixed in
- no fixed version recorded
Sources
- GitHub Advisory Database and maintainer security advisories on GitHub
GitHub-reviewed advisory GHSA-9g5q-2w5x-hmxf lists affected ranges: Go github.com/go-chi/chi/middleware >=0.9.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 The vulnerability allows the Request.RemoteAddr to be spoofed when determining the request source IP via the X-Forwarded-For header. This could result in misidentification of the request source and potentially compromise access control and logging integrity. Details Currently, the RealIP() implementation splits the X-Forwarded-For header by , and uses the first IP. https://github.com/go-chi/chi/blob/v5.1.0/middleware/realip.go#L50-L54 However, relying on the first IP in the X-Forwarded-For header is insecure because it can be manipulated by attackers to falsify the source IP. Malicious Case: 1. A malicious client sends a request with a forged IP in the X-Forwarded-For header: X-Forwarded-For: <forged-ip 2. The proxy appends the actual client’s IP and forwards the request: X-Forwarded-For: <forged-ip,<client-ip 3. If the server always uses the first IP, it becomes vulnerable to IP spoofing. Ideally, the implementation should verify IPs starting from the end of the…
Dates and revisions
- Published by the source
- Last modified by the source
- Source last checked
- Revision 1 · created ·
Published from ghsa record GHSA-9g5q-2w5x-hmxf
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-9g5q-2w5x-hmxf Advisory: chi Middleware Vulnerable to Potential IP Spoofing via `X-Forwarded-For` Header in `Request.RemoteAddr` Resolution IDs: GHSA-9g5q-2w5x-hmxf Record: https://patchnext.com/advisories/ghsa-9g5q-2w5x-hmxf (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 >= 0.9.0, <= 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-9g5q-2w5x-hmxf (GitHub-reviewed advisory GHSA-9g5q-2w5x-hmxf lists affected ranges: Go github.com/go-chi/chi/middleware >=0.9.0 =0 =0 =0 =0 <5.3.0) Commands are suggestions: review each one before running it.
Loading voting…