Skip to content

← Actionable
Medium, CVSS 6.9amended

chi Has an IP Spoofing Vulnerability in middleware.RealIP

CVE-2026-72815GHSA-3fxj-6jh8-hvhx

What to do

Vendor fix available. Upgrade each affected package to the fixed version on its release line (github.com/go-chi/chi/v5 5.3.0; github.com/go-chi/chi/v5/middleware 5.3.0), redeploy, then verify what is actually installed.

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

Sources

Severity and exploitation
Exploitation
No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
CVSS 4.0
6.9 · 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 · score source
EPSS
  • CVE-2026-72815: 0.50% estimated exploitation activity in the next 30 days; percentile 42.51 (FIRST EPSS, 2026-11-03). This is a model estimate, not proof of exploitation or customer exposure.
Source description

As published by the source; long descriptions are shortened.

Summary The `RealIP` middleware in `go-chi/chi` is vulnerable to IP spoofing because it blindly trusts the first (leftmost) element of the `X-Forwarded-For` HTTP header. This allows a remote attacker to bypass IP-based access control lists (ACLs) and rate-limiting mechanisms by providing a spoofed IP address in the header.

Details In `middleware/realip.go`, the `realIP` function parses the `X-Forwarded-For` header and extracts the first comma-separated value: ```go func realIP(r *http.Request) string { // ... } else if xff := r.Header.Get(xForwardedFor); xff != "" { ip, _, _ = strings.Cut(xff, ",") } // ... } ``` Standard practice for `X-Forwarded-For` is that each proxy appends the client's IP to the end of the list. However, since the client can also provide this header, the leftmost values are untrusted. A client can send a header like `X-Forwarded-For: , `, and `go-chi/chi` will treat ` ` as the source of the request.

Proof of Concept (PoC) The following code…

Dates and revisions
Published by the source
Last modified by the source
Source last checked
  1. Revision 3 · amended ·

    Amended from osv record GHSA-3fxj-6jh8-hvhx

  2. Revision 2 · amended ·

    Amended from ghsa record GHSA-3fxj-6jh8-hvhx

  3. Revision 1 · created ·

    Published from ghsa record GHSA-3fxj-6jh8-hvhx

Agent brief

Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.

# Patch Next advisory brief: CVE-2026-72815

Advisory: chi Has an IP Spoofing Vulnerability in `middleware.RealIP`
IDs: CVE-2026-72815, GHSA-3fxj-6jh8-hvhx
Record: https://patchnext.com/advisories/ghsa-3fxj-6jh8-hvhx (revision 3, source checked 4 Nov 2026, 06:30 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: Medium (CVSS 6.9)
Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV.
Vendor response: Vendor fix available; fixed versions by package: github.com/go-chi/chi/v5 5.3.0; 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/v5: affected >= 5.2.1, < 5.3.0; fixed in 5.3.0
- Go github.com/go-chi/chi/v5/middleware: affected >= 5.2.1, < 5.3.0; fixed in 5.3.0

## Suggested inspection (read-only)
- Go github.com/go-chi/chi/v5: check the installed version with your package manager.
- Go github.com/go-chi/chi/v5/middleware: check the installed version with your package manager.

## Supported action
Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version.

## Required regression checks
- Run the test suite and a production build.
- Exercise the features that depend on github.com/go-chi/chi/v5, github.com/go-chi/chi/v5/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-3fxj-6jh8-hvhx (GitHub-reviewed advisory GHSA-3fxj-6jh8-hvhx lists affected ranges: Go github.com/go-chi/chi/v5/middleware >=5.2.1 <5.3.0)
- Verified: https://github.com/advisories/GHSA-3fxj-6jh8-hvhx (GitHub-reviewed advisory GHSA-3fxj-6jh8-hvhx lists affected ranges: Go github.com/go-chi/chi/v5/middleware >=5.2.1 =5.2.1 <5.3.0)
- Verified: https://osv.dev/vulnerability/GHSA-3fxj-6jh8-hvhx (OSV record GHSA-3fxj-6jh8-hvhx lists affected ranges: Go github.com/go-chi/chi/v5/middleware >=5.2.1 =5.2.1 <5.3.0 (fixed))

Commands are suggestions: review each one before running it.

Loading voting…