Skip to content
Heist/ feed
Back to feed
MediumFix available

chi: Client IP spoofing in ClientIPFromXFF via X-Forwarded-For

Type: advisorySources: OSV

### 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. 1. Send `GET /admin` directly to the origin with no `X-Forwarded-For` header. 2. Observe a `403 Forbidden` response and an empty derived client IP. 3. Repeat the request with `X-Forwarded-For: 10.0.0.7, 198.51.100.42`. 4. Observe `200 OK` and `client-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: ```go walkXFF(r.Header[xForwardedForHeader], func(v string) bool

Products
github.com/go-chi/chi/v5
Affected versions
Not specified
Fixed versions
5.4.0
CVEs
CVE-2026-114437
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 03:19 UTC · Revision 1

Source evidence

chi: Client IP spoofing in ClientIPFromXFF via X-Forwarded-For

core-osv · Original source

Published 23 Oct 2026, 20:56 UTC

### 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. 1. Send `GET /admin` directly to the origin with no `X-Forwarded-For` header. 2. Observe a `403 Forbidden` response and an empty derived client IP. 3. Repeat the request with `X-Forwarded-For: 10.0.0.7, 198.51.100.42`. 4. Observe `200 OK` and `client-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: ```go walkXFF(r.Header[xForwardedForHeader], func(v string) bool

osv:GHSA-j6qf-3m9c-vwj3

github.com/go-chi/chi/v5

Fixed versions: 5.4.0

Complete source record
{
  "id": "62462a66b78ef69c01391fd6e00084189092abdfdcb342b3005eb2f08e023633",
  "url": "https://osv.dev/vulnerability/GHSA-j6qf-3m9c-vwj3",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "chi: Client IP spoofing in ClientIPFromXFF via X-Forwarded-For",
    "summary": "### 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. 1. Send `GET /admin` directly to the origin with no `X-Forwarded-For` header. 2. Observe a `403 Forbidden` response and an empty derived client IP. 3. Repeat the request with `X-Forwarded-For: 10.0.0.7, 198.51.100.42`. 4. Observe `200 OK` and `client-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: ```go walkXFF(r.Header[xForwardedForHeader], func(v string) bool",
    "evidence": "osv:GHSA-j6qf-3m9c-vwj3",
    "products": [
      {
        "name": {
          "value": "github.com/go-chi/chi/v5",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "5.4.0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "GHSA-j6qf-3m9c-vwj3",
      "aliases": [
        "CVE-2026-114437",
        "GHSA-j6qf-3m9c-vwj3"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "5.4.0"
                }
              ]
            }
          ],
          "package": {
            "name": "github.com/go-chi/chi/v5",
            "purl": "pkg:golang/github.com/go-chi/chi/v5",
            "ecosystem": "Go"
          },
          "database_specific": {
            "source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-j6qf-3m9c-vwj3/GHSA-j6qf-3m9c-vwj3.json",
            "last_known_affected_version_range": "<= 5.3.2"
          }
        }
      ],
      "modified": "2026-10-23T21:15:03.935320289Z",
      "provider": "osv",
      "references": [
        "https://github.com/go-chi/chi/security/advisories/GHSA-j6qf-3m9c-vwj3",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-114437",
        "https://github.com/go-chi/chi/pull/1214",
        "https://github.com/go-chi/chi/commit/7f9b7448f51d28804fac98c0a17bc2a7cec1079f",
        "https://github.com/go-chi/chi",
        "https://github.com/go-chi/chi/releases/tag/v5.4.0",
        "https://www.tenable.com/security/research/tra-2026-66"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-345"
        ],
        "severity": "MODERATE",
        "github_reviewed": true,
        "nvd_published_at": null,
        "github_reviewed_at": "2026-10-23T20:56:46Z"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-114437",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 427038,
  "published_at": "2026-10-23T20:56:46+00:00"
}