---
id: CVE-2026-72816
title: >-
  go-chi/chi through 5.2.1 contains an IP spoofing vulnerability in the RealIP
  middleware (middleware/realip.go)
summary: >-
  go-chi/chi through 5.2.1 contains an IP spoofing vulnerability in the RealIP
  middleware (middleware/realip.go). The realIP() function reads
  client-controlled headers (True-Client-IP, X-Real-IP, and X-Forwarded-For) and
  overwrites r.Remot…
severity: medium
cvss: 6.5
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N'
cwe:
  - CWE-290
vendor: go-chi
product: github.com/go-chi/chi/middleware
affected:
  - github.com/go-chi/chi/middleware <= 1.5.5
  - github.com/go-chi/chi/v2/middleware <= 2.1.1
  - github.com/go-chi/chi/v3/middleware <= 3.3.5
  - github.com/go-chi/chi/v4/middleware <= 4.1.3
  - github.com/go-chi/chi/v5/middleware < 5.3.0
patched:
  - github.com/go-chi/chi/v5/middleware 5.3.0
published: '2026-08-14'
updated: '2026-09-09'
sourceUpdated: '2026-09-09T20:35:08.537'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-72816'
references:
  - url: 'https://github.com/go-chi/chi/security/advisories/GHSA-rjr7-jggh-pgcp'
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/go-chi-chi-before-ip-spoofing-via-realip-middleware
    label: disclosure@vulncheck.com
  - url: 'https://github.com/go-chi/chi/security/advisories/GHSA-rjr7-jggh-pgcp'
    label: 134c704f-9b21-4f2e-91b3-4a467353bcc0
  - url: 'https://github.com/go-chi/chi'
  - url: 'https://github.com/go-chi/chi/releases/tag/v5.3.0'
tags:
  - nvd
  - osv
  - go
epss: 0.003
epssPercentile: 0.20288
aliases:
  - GHSA-rjr7-jggh-pgcp
  - GO-2026-5777
ecosystem: go
ingestedAt: '2026-08-15T19:19:53.771Z'
---

## Overview

go-chi/chi through 5.2.1 contains an IP spoofing vulnerability in the RealIP middleware (middleware/realip.go). The realIP() function reads client-controlled headers (True-Client-IP, X-Real-IP, and X-Forwarded-For) and overwrites r.RemoteAddr without verifying that the request originated from a trusted proxy. Attackers can supply arbitrary IP addresses in these headers to bypass IP-based access controls, evade rate limiting and geo-IP restrictions, and pollute audit logs. Fixed in 5.3.0.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.

## Package advisory (CVE-2026-72816)

Affected packages:

- `github.com/go-chi/chi/middleware <= 1.5.5`
- `github.com/go-chi/chi/v2/middleware <= 2.1.1`
- `github.com/go-chi/chi/v3/middleware <= 3.3.5`
- `github.com/go-chi/chi/v4/middleware <= 4.1.3`
- `github.com/go-chi/chi/v5/middleware < 5.3.0`

Patched in:

- `github.com/go-chi/chi/v5/middleware 5.3.0`

Source: https://osv.dev/vulnerability/GHSA-rjr7-jggh-pgcp
