# GHSA-CQW7-RMGJ-Q96H: \[G1\] Relay WS handler trusts spoofable X-Real-IP / X-Real-Port from any peer

- Database: GitHub
- Severity: CVSS 5.3 (Medium)
- Published: 2026-11-18
- Modified: 2026-11-24

## Tracked as

- [CVE-2026-135779](https://cve.now/CVE-2026-135779.md): NetBird source address spoofing in relay WebSocket listener

## Affected versions

- github.com/netbirdio/netbird (Go): from 0.31.1, fixed in 0.75.0

## Description

# Advisory 16 — [G1] Relay WS handler trusts spoofable X-Real-IP / X-Real-Port from any peer

- **Severity:** Medium
- **CVSS 4.0 Base Score:** **5.3**
- **CVSS 4.0 Vector:** `CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N`
- **CWE:** [CWE-348](https://cwe.mitre.org/data/definitions/348.html), [CWE-290](https://cwe.mitre.org/data/definitions/290.html) (CWE-348, CWE-290)
- **Affected versions:** `github.com/netbirdio/netbird` `>= 0.31.1, < 0.75.0`
- **Patched in:** 0.75.0 — https://github.com/netbirdio/netbird/pull/6833
- **Affected component(s):** relay xrealip
- **Reporter:** [@SecurinDisclose](https://github.com/SecurinDisclose) — Arjun Basnet · Securin Inc. — `arjun.basnet@securin.io`


---

## Overview

```go
if ip := r.Header.Get("X-Real-Ip"); ip != "" {
    remoteAddr = net.JoinHostPort(ip, r.Header.Get("X-Real-Port"))
}
```

Whatever the client sends in `X-Real-Ip` / `X-Real-Port` is used as the peer's
observed source address — unconditionally, without verifying the request came
from a trusted upstream proxy. Any WebSocket client can forge its IP.

---

## Affected Location

- `relay/server/listener/ws/listener.go:105` — remoteAddr overwrite from headers.

---

## Vulnerable Code

```go
if ip := r.Header.Get("X-Real-Ip"); ip != "" {
    remoteAddr = net.JoinHostPort(ip, r.Header.Get("X-Real-Port"))
}
```

---

## Reproduction

A WebSocket client connecting to the relay from `127.0.0.1` with the header
`X-Real-Ip: 8.8.8.8` and `X-Real-Port: 9999` is recorded by the server with the
remote address `8.8.8.8:9999`.

### PoC output

```
=== RUN   TestH12_RelayXRealIP
    poc_test.go:39: connected from 127.0.0.1 with X-Real-Ip: 8.8.8.8
    poc_test.go:44: server logged remoteAddr = 8.8.8.8:9999
--- PASS: TestH12_RelayXRealIP
```


---

## Impact

A WebSocket client that sends both headers makes the relay use an arbitrary address as
the remote address of its connection, including in the relay's "WS client connected from"
log line. A client can therefore hide its real address or attribute its connection to
another host. See the CVSS 4.0 vector above for the scored impact.

---

## Fix

Fixed in 0.75.0 ([#6833](https://github.com/netbirdio/netbird/pull/6833)).

The relay now honours `X-Real-Ip` and `X-Real-Port` only for requests whose direct
connection address is inside a configured set of trusted proxies. Requests from any other
address are served with their direct connection address. The set is configured
with the `--trusted-proxies` flag, a comma-separated list of CIDRs or IPs. When it is
empty, which is the default, the headers are ignored and the direct connection address
is always used.

Operators who run the relay behind a reverse proxy and relied on the forwarded address
must set `--trusted-proxies` to the proxy's address after upgrading.

## Affected platforms

The relay server only. The NetBird client, including the Android and iOS apps, does not
run the relay listener and is not affected.

---

## Remediation

1. Only trust `X-Real-Ip` when the request came from a configured trusted proxy.
2. Ship without header trust by default; require explicit opt-in.
3. Log both raw `RemoteAddr` and any header-derived value to catch mismatches.

---

## References & Evidence

- **CWE definitions:** [CWE-348](https://cwe.mitre.org/data/definitions/348.html), [CWE-290](https://cwe.mitre.org/data/definitions/290.html)
- **CVSS 4.0 calculator:** https://www.first.org/cvss/calculator/4-0#CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
- **Fix:** [#6833](https://github.com/netbirdio/netbird/pull/6833)

---

## Credit

Reported by **Arjun Basnet** — [Securin Inc.](https://securin.io) — via GitHub [@SecurinDisclose](https://github.com/SecurinDisclose).
Coordinated disclosure timeline: **90 days** — public disclosure on or after **2026-10-11** unless extended by mutual agreement.

---

## Private Audit Bundle

The reporter's full reproduction bundle (labs, PoCs, live-target evidence) is available at
**https://github.com/SecurinDisclose/netbird-0.74.3-audit** (private — request read access via GitHub or email `arjun.basnet@securin.io`).

## Coordinated Disclosure

- **Reporter:** [@SecurinDisclose](https://github.com/SecurinDisclose) — Arjun Basnet, Securin Inc.
- **Contact:** `arjun.basnet@securin.io`
- **Public-disclosure deadline:** 2026-10-11 (90 days from 2026-07-13)

## References

- https://github.com/netbirdio/netbird/security/advisories/GHSA-cqw7-rmgj-q96h

Page: https://cve.now/GHSA-CQW7-RMGJ-Q96H

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
