{"id":"GHSA-cjr6-pf59-jq29","aliases":[],"summary":"ingress-nginx from-to-www-redirect sibling router serves the auth-protected backend without auth","published_at":"2026-08-27T07:50:13Z","modified_at":"2026-08-27T07:50:13Z","products":[{"slug":"traefik","name":"Traefik","category":"proxy"}],"rating":{"severity":"high","attack_path":"unknown","user_interaction":false,"malicious":false,"vendor_ratings":[{"source":"GitHub","rating":"high"}]},"fix_available":true,"kev":{"listed":false,"ransomware":false},"public_exploit":false,"exploits":[],"priority":3,"record_count":1,"vendors":["GitHub"],"details":"## Summary\n\nThere is a high severity vulnerability in Traefik's Kubernetes ingress-nginx provider. For an Ingress carrying both an authentication annotation and `nginx.ingress.kubernetes.io/from-to-www-redirect`, the provider created a second router matching on the host alone that carried only the `RedirectRegex` middleware while still pointing at the parent's protected backend service. `RedirectRegex` is not a terminal handler: a request its pattern does not match is forwarded to the next handler. Because the redirect pattern accepted only a numeric port while Traefik's host matcher canonicalizes any authority, a request carrying a non-numeric or empty port (`Host: www.example.com:x`) selected the sibling router, missed the redirect, and was proxied to the protected backend with none of the Ingress's annotation-derived middlewares applied. Authentication is not the only middleware lost: every annotation-derived middleware is discarded on that router, so source-IP allowlisting and the rest are equally absent.\n\nTraefik v2 is not affected, and neither is any v3 release before v3.7.0: the ingress-nginx provider's from-to-www-redirect handling was introduced in v3.7.0.\n\n## Patches\n\n- https://github.com/traefik/traefik/releases/tag/v3.7.12\n\n## For more information\n\nIf you have any questions or comments about this advisory, please [open an issue](https://github.com/traefik/traefik/issues).\n\n<details>\n<summary>Original Description</summary>\n\n# Traefik: the ingress-nginx from-to-www-redirect sibling router serves an auth-protected backend without auth\n\n**ANT-ID:** ANT-2026-EYY7M3H3\n\n## Summary\n\nFor a Kubernetes Ingress carrying both an auth annotation and\n`nginx.ingress.kubernetes.io/from-to-www-redirect`, the ingress-nginx provider creates a\nsecond router that matches on the host alone, carries **only** the `RedirectRegex`\nmiddleware, and is pointed at the parent's real backend service. `RedirectRegex` is not a\nterminal handler: `pkg/middlewares/redirect/redirect.go` forwards every request its pattern\ndoes not match to the next handler, which for this router is the backend. The pattern\ncannot match an authority whose port is not numeric, while `net.SplitHostPort`, and hence\nthe canonical host the `Host()` matcher compares against, accepts one. So\n`Host: www.example.com:x` selects the sibling router, misses the redirect, and is proxied\nto the protected backend with no authentication at all. Affects v3.7.10, the latest\nrelease, and HEAD.\n\n> Discovered by AI and verified by humans; credit Calif.io in collaboration with Anthropic.\n\n## Technical Details\n\n`applyFromToWwwRedirect()` (`pkg/provider/kubernetes/ingress-nginx/translator.go:546`) is\ncalled immediately after `p.applyMiddlewares()` has populated `rt.Middlewares` with the\nIngress's auth middleware. It then builds a new router that inherits `rt.Service` but\nreplaces the middleware chain outright:\n\n```go\nconf.HTTP.Routers[routerKey+\"-from-to-www-redirect\"] = &dynamic.Router{\n    EntryPoints:   rt.EntryPoints,\n    Rule:          f.ExtraRouterRule,     // Host(\"www.example.com\"), no path constraint\n    Priority:      rt.Priority,\n    Middlewares:   []string{mwName},      // only the redirect; rt.Middlewares discarded\n    Service:       rt.Service,            // the parent's protected backend\n    TLS:           rt.TLS,\n}\n```\n\nThe authorization is not bypassed so much as never attached to that route, and because\n`applyMiddlewares()` is where every annotation-derived middleware is attached, the sibling\ndiscards all of them, not only BasicAuth. We confirmed the same 401-to-200 transition on an\nIngress guarded by `whitelist-source-range` instead, which returns 403 on the parent and\n200 on the sibling.\n\nWhat turns that into a reachable bypass is a disagreement between two parsers about the\nsame authority. The redirect pattern is `(https?)://[^/:]+(:[0-9]+)?/(.*)`: `[^/:]+` stops\nat the first colon and `(:[0-9]+)?` accepts only digits, so for\n`http://www.example.com:x/admin/secret` the optional group matches empty and the pattern\nthen requires `/` while the next character is still `:`. No match. Meanwhile\n`requestdecorator` derives the canonical host with `net.SplitHostPort`, which accepts that\nauthority and yields `www.example.com`, so the `Host()` rule selects this router. The\nrequest therefore arrives at a router with no auth, fails to redirect, and falls through to\n`r.next`. A bare trailing colon (`Host: www.example.com:`) is sufficient; no exotic value is\nneeded. Because the sibling rule carries no `PathPrefix`, paths that appear nowhere in the\nIngress are reachable too, and the method is unconstrained.\n\n## Reproduce\n\n```\n./run.sh          # ~2 min: builds traefik v3.7.10, runs the provider, drives the exploit\n```\n\nThe harness writes no configuration by hand. `poc_dump_test.go` drives the real\ningress-nginx provider over a fake Kubernetes API with an ordinary Ingress carrying\n`auth-type: basic` and `from-to-www-redirect`, and the configuration it emits is what the\ntraefik binary then serves. The provider output shows the defect before any request is\nsent: a sibling router with `service: default-poc-protected-80` and `middlewares:\n[redirect only]`.\n\n```\nGET /admin/secret   Host: example.com         no creds  -> 401 Unauthorized   origin not reached\nGET /admin/secret   Host: example.com         creds     -> 200 + secret       origin reached\nGET /admin/secret   Host: www.example.com:x   no creds  -> 200 + secret       origin reached\n```\n\nThe origin logs `BACKEND-RECEIVED request-line='GET /admin/secret HTTP/1.1'\nhost='www.example.com:x'`, and the response carries the origin's own `X-Served-By` header\nand body, so the request was proxied rather than redirected.\n\nFour cases isolate the mechanism, each differing from the exploit in one respect:\n`Host: www.example.com` (no port) returns 302 with a correct `Location` and the origin is\nnot reached; `Host: www.example.com:8080` (numeric port) likewise; `Host:\nunrelated.example.net:x` returns 404. The important one is `Host: example.com:x`, the same\nmalformed authority sent to the **parent** router, which still returns 401. The malformed\nport is not itself an authorization bypass; it is a bypass only because it selects a\nsibling router that carries no authorization.\n\n## Recommendations\n\nTwo independent changes, either of which closes the reported path. The complete diff is in\n`suggested-fix.patch`.\n\nFirst, match the authority as everything up to the path, capturing only a numeric port, so\na malformed or empty port canonicalises into a redirect instead of falling through:\n\n```diff\n-\t\t\tRegex:       `(https?)://[^/:]+(:[0-9]+)?/(.*)`,\n+\t\t\tRegex:       `(https?)://[^/]*?(:[0-9]+)?/(.*)`,\n```\n\nSecond, point the redirect-only router at the provider's existing 503\n`unavailable-service` rather than at the protected backend. That router is never intended\nto proxy, and with no auth middleware on it any fall-through is by definition\nunauthenticated access, so this removes the class rather than the instance and also covers\ninputs the pattern cannot express.\n\nWe recognise the second change alters provider output and updates four golden expectations\nin `kubernetes_test.go`. The first change alone fixes the reported trigger, so if you would\nrather take only that, it stands on its own; we are offering the second as defence in\ndepth rather than pressing for it.\n\n> Patch verified: with both changes applied, every exploit case becomes a redirect with a\n> correct `Location` and the origin is never reached, while the 401, 200, 403 and both\n> redirect cases are unchanged. Upstream's own `go test\n> ./pkg/provider/kubernetes/ingress-nginx/...` passes.\n\n## Notes for the reviewer\n\n- This is not a regression and not an incomplete patch. We checked the commits rather than\n  inferring: `applyFromToWwwRedirect` is byte-identical at v3.7.7, v3.7.8 and v3.7.10, and\n  the release that addressed GHSA-8rxv-jg7p-wvg3 touched only `rewrite_target.go`,\n  `snippet/action.go` and `retry.go`. This is the same class left open by remediation that\n  reviewed the path-rewriting middlewares.\n- One fidelity artifact of the harness, unrelated to the finding:\n  `RedirectRegex.StatusCode` is `json:\"-\"`, so the provider's 308 is lost in the\n  file-provider round trip and redirects show as 302 or 307 where a real cluster shows 308.\n  The finding concerns requests that are not redirected.\n- We drove the real provider through a fake Kubernetes API rather than a live cluster. The\n  provider code and the traefik binary are genuine; the cluster is not.\n- Reproduced on linux/arm64 with Go 1.26.0, which traefik's `go.mod` requires. This is\n  routing and authorization logic with no architecture dependence.\n\n## Artifacts\n\n| filename | purpose |\n|---|---|\n| `run.sh` | one command: build v3.7.10, generate the config from the provider, run all cases |\n| `poc_dump_test.go` | drives the real ingress-nginx provider over a fake Kubernetes API |\n| `poc.py` | the client; `--mode exploit\\|control\\|postfix` |\n| `backend.py` | instrumented origin that logs the raw request line it receives |\n| `poc-eyy7m3h3.yml` | the Ingress used |\n| `suggested-fix.patch` | both changes, with the golden-fixture updates |\n| `exploit_transcript.txt` | full request and response transcript, all cases |\n\n**PoC bundle:** https://drive.google.com/file/d/18_bwMG_GpvpxVqOeHbRagF4N63z8dehg/view?usp=sharing\n\n\n</details>","affected_stack":[{"ecosystem":"Go","package":"github.com/traefik/traefik/v3","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"v3.7.0"},{"fixed":"v3.7.12"}]}],"fixed":["v3.7.12"],"provider":"github-repo-advisories","source":"GHSA-cjr6-pf59-jq29","relation":"self"}],"affected_other":[],"product_status":[],"records":[{"provider":"github-repo-advisories","source_id":"GHSA-cjr6-pf59-jq29","relation":"self","url":"https://github.com/traefik/traefik/security/advisories/GHSA-cjr6-pf59-jq29","license":"GitHub Terms of Service","published_at":"2026-08-27T07:50:13Z","modified_at":"2026-08-27T07:50:13Z","summary":"ingress-nginx from-to-www-redirect sibling router serves the auth-protected backend without auth","details":"## Summary\n\nThere is a high severity vulnerability in Traefik's Kubernetes ingress-nginx provider. For an Ingress carrying both an authentication annotation and `nginx.ingress.kubernetes.io/from-to-www-redirect`, the provider created a second router matching on the host alone that carried only the `RedirectRegex` middleware while still pointing at the parent's protected backend service. `RedirectRegex` is not a terminal handler: a request its pattern does not match is forwarded to the next handler. Because the redirect pattern accepted only a numeric port while Traefik's host matcher canonicalizes any authority, a request carrying a non-numeric or empty port (`Host: www.example.com:x`) selected the sibling router, missed the redirect, and was proxied to the protected backend with none of the Ingress's annotation-derived middlewares applied. Authentication is not the only middleware lost: every annotation-derived middleware is discarded on that router, so source-IP allowlisting and the rest are equally absent.\n\nTraefik v2 is not affected, and neither is any v3 release before v3.7.0: the ingress-nginx provider's from-to-www-redirect handling was introduced in v3.7.0.\n\n## Patches\n\n- https://github.com/traefik/traefik/releases/tag/v3.7.12\n\n## For more information\n\nIf you have any questions or comments about this advisory, please [open an issue](https://github.com/traefik/traefik/issues).\n\n<details>\n<summary>Original Description</summary>\n\n# Traefik: the ingress-nginx from-to-www-redirect sibling router serves an auth-protected backend without auth\n\n**ANT-ID:** ANT-2026-EYY7M3H3\n\n## Summary\n\nFor a Kubernetes Ingress carrying both an auth annotation and\n`nginx.ingress.kubernetes.io/from-to-www-redirect`, the ingress-nginx provider creates a\nsecond router that matches on the host alone, carries **only** the `RedirectRegex`\nmiddleware, and is pointed at the parent's real backend service. `RedirectRegex` is not a\nterminal handler: `pkg/middlewares/redirect/redirect.go` forwards every request its pattern\ndoes not match to the next handler, which for this router is the backend. The pattern\ncannot match an authority whose port is not numeric, while `net.SplitHostPort`, and hence\nthe canonical host the `Host()` matcher compares against, accepts one. So\n`Host: www.example.com:x` selects the sibling router, misses the redirect, and is proxied\nto the protected backend with no authentication at all. Affects v3.7.10, the latest\nrelease, and HEAD.\n\n> Discovered by AI and verified by humans; credit Calif.io in collaboration with Anthropic.\n\n## Technical Details\n\n`applyFromToWwwRedirect()` (`pkg/provider/kubernetes/ingress-nginx/translator.go:546`) is\ncalled immediately after `p.applyMiddlewares()` has populated `rt.Middlewares` with the\nIngress's auth middleware. It then builds a new router that inherits `rt.Service` but\nreplaces the middleware chain outright:\n\n```go\nconf.HTTP.Routers[routerKey+\"-from-to-www-redirect\"] = &dynamic.Router{\n    EntryPoints:   rt.EntryPoints,\n    Rule:          f.ExtraRouterRule,     // Host(\"www.example.com\"), no path constraint\n    Priority:      rt.Priority,\n    Middlewares:   []string{mwName},      // only the redirect; rt.Middlewares discarded\n    Service:       rt.Service,            // the parent's protected backend\n    TLS:           rt.TLS,\n}\n```\n\nThe authorization is not bypassed so much as never attached to that route, and because\n`applyMiddlewares()` is where every annotation-derived middleware is attached, the sibling\ndiscards all of them, not only BasicAuth. We confirmed the same 401-to-200 transition on an\nIngress guarded by `whitelist-source-range` instead, which returns 403 on the parent and\n200 on the sibling.\n\nWhat turns that into a reachable bypass is a disagreement between two parsers about the\nsame authority. The redirect pattern is `(https?)://[^/:]+(:[0-9]+)?/(.*)`: `[^/:]+` stops\nat the first colon and `(:[0-9]+)?` accepts only digits, so for\n`http://www.example.com:x/admin/secret` the optional group matches empty and the pattern\nthen requires `/` while the next character is still `:`. No match. Meanwhile\n`requestdecorator` derives the canonical host with `net.SplitHostPort`, which accepts that\nauthority and yields `www.example.com`, so the `Host()` rule selects this router. The\nrequest therefore arrives at a router with no auth, fails to redirect, and falls through to\n`r.next`. A bare trailing colon (`Host: www.example.com:`) is sufficient; no exotic value is\nneeded. Because the sibling rule carries no `PathPrefix`, paths that appear nowhere in the\nIngress are reachable too, and the method is unconstrained.\n\n## Reproduce\n\n```\n./run.sh          # ~2 min: builds traefik v3.7.10, runs the provider, drives the exploit\n```\n\nThe harness writes no configuration by hand. `poc_dump_test.go` drives the real\ningress-nginx provider over a fake Kubernetes API with an ordinary Ingress carrying\n`auth-type: basic` and `from-to-www-redirect`, and the configuration it emits is what the\ntraefik binary then serves. The provider output shows the defect before any request is\nsent: a sibling router with `service: default-poc-protected-80` and `middlewares:\n[redirect only]`.\n\n```\nGET /admin/secret   Host: example.com         no creds  -> 401 Unauthorized   origin not reached\nGET /admin/secret   Host: example.com         creds     -> 200 + secret       origin reached\nGET /admin/secret   Host: www.example.com:x   no creds  -> 200 + secret       origin reached\n```\n\nThe origin logs `BACKEND-RECEIVED request-line='GET /admin/secret HTTP/1.1'\nhost='www.example.com:x'`, and the response carries the origin's own `X-Served-By` header\nand body, so the request was proxied rather than redirected.\n\nFour cases isolate the mechanism, each differing from the exploit in one respect:\n`Host: www.example.com` (no port) returns 302 with a correct `Location` and the origin is\nnot reached; `Host: www.example.com:8080` (numeric port) likewise; `Host:\nunrelated.example.net:x` returns 404. The important one is `Host: example.com:x`, the same\nmalformed authority sent to the **parent** router, which still returns 401. The malformed\nport is not itself an authorization bypass; it is a bypass only because it selects a\nsibling router that carries no authorization.\n\n## Recommendations\n\nTwo independent changes, either of which closes the reported path. The complete diff is in\n`suggested-fix.patch`.\n\nFirst, match the authority as everything up to the path, capturing only a numeric port, so\na malformed or empty port canonicalises into a redirect instead of falling through:\n\n```diff\n-\t\t\tRegex:       `(https?)://[^/:]+(:[0-9]+)?/(.*)`,\n+\t\t\tRegex:       `(https?)://[^/]*?(:[0-9]+)?/(.*)`,\n```\n\nSecond, point the redirect-only router at the provider's existing 503\n`unavailable-service` rather than at the protected backend. That router is never intended\nto proxy, and with no auth middleware on it any fall-through is by definition\nunauthenticated access, so this removes the class rather than the instance and also covers\ninputs the pattern cannot express.\n\nWe recognise the second change alters provider output and updates four golden expectations\nin `kubernetes_test.go`. The first change alone fixes the reported trigger, so if you would\nrather take only that, it stands on its own; we are offering the second as defence in\ndepth rather than pressing for it.\n\n> Patch verified: with both changes applied, every exploit case becomes a redirect with a\n> correct `Location` and the origin is never reached, while the 401, 200, 403 and both\n> redirect cases are unchanged. Upstream's own `go test\n> ./pkg/provider/kubernetes/ingress-nginx/...` passes.\n\n## Notes for the reviewer\n\n- This is not a regression and not an incomplete patch. We checked the commits rather than\n  inferring: `applyFromToWwwRedirect` is byte-identical at v3.7.7, v3.7.8 and v3.7.10, and\n  the release that addressed GHSA-8rxv-jg7p-wvg3 touched only `rewrite_target.go`,\n  `snippet/action.go` and `retry.go`. This is the same class left open by remediation that\n  reviewed the path-rewriting middlewares.\n- One fidelity artifact of the harness, unrelated to the finding:\n  `RedirectRegex.StatusCode` is `json:\"-\"`, so the provider's 308 is lost in the\n  file-provider round trip and redirects show as 302 or 307 where a real cluster shows 308.\n  The finding concerns requests that are not redirected.\n- We drove the real provider through a fake Kubernetes API rather than a live cluster. The\n  provider code and the traefik binary are genuine; the cluster is not.\n- Reproduced on linux/arm64 with Go 1.26.0, which traefik's `go.mod` requires. This is\n  routing and authorization logic with no architecture dependence.\n\n## Artifacts\n\n| filename | purpose |\n|---|---|\n| `run.sh` | one command: build v3.7.10, generate the config from the provider, run all cases |\n| `poc_dump_test.go` | drives the real ingress-nginx provider over a fake Kubernetes API |\n| `poc.py` | the client; `--mode exploit\\|control\\|postfix` |\n| `backend.py` | instrumented origin that logs the raw request line it receives |\n| `poc-eyy7m3h3.yml` | the Ingress used |\n| `suggested-fix.patch` | both changes, with the golden-fixture updates |\n| `exploit_transcript.txt` | full request and response transcript, all cases |\n\n**PoC bundle:** https://drive.google.com/file/d/18_bwMG_GpvpxVqOeHbRagF4N63z8dehg/view?usp=sharing\n\n\n</details>","severity":[{"type":"GitHub","score":"high","source":"GHSA-cjr6-pf59-jq29"}],"affected":[{"ecosystem":"Go","package":"github.com/traefik/traefik/v3","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"v3.7.0"},{"fixed":"v3.7.12"}]}],"fixed":["v3.7.12"],"provider":"github-repo-advisories","source":"GHSA-cjr6-pf59-jq29","relation":"self"}],"product_status":[],"references":[{"type":"ADVISORY","url":"https://github.com/traefik/traefik/security/advisories/GHSA-cjr6-pf59-jq29"}]}],"references":[{"type":"ADVISORY","url":"https://github.com/traefik/traefik/security/advisories/GHSA-cjr6-pf59-jq29"}],"sources":[{"provider":"github-repo-advisories","source_id":"GHSA-cjr6-pf59-jq29","url":"https://github.com/traefik/traefik/security/advisories/GHSA-cjr6-pf59-jq29","license":"GitHub Terms of Service","modified_at":"2026-08-27T07:50:13Z","relation":"self"}]}
