-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The pre-patch line is one call to `CopyHeaders`. The patch wrapped it.\n\nIn `pkg/middlewares/customerrors/custom_errors.go`, the pre-patch `ServeHTTP` builds a fresh `pageReq` aimed at the error-page service, populates its URL from the operator's `query` template, and then runs one line that the April 24 fix for CVE-2026-41181 wraps and preserves:\n\n```go\nutils.CopyHeaders(pageReq.Header, req.Header)\n\nc.backendHandler.ServeHTTP(newCodeModifier(rw, code),\n pageReq.WithContext(req.Context()))\n```\n\n`utils.CopyHeaders` is `github.com/vulcand/oxy/v2/utils.CopyHeaders`. The function is a `range` over the source `http.Header` map: for each key, copy the slice of values into the destination. The function has no allowlist, no denylist, and no header-name awareness. Every key on the inbound `req.Header` map ends up on `pageReq.Header`. `Authorization`, `Cookie`, `X-Api-Key`, `X-Auth-Token`, `X-Forwarded-User`, `X-Forwarded-For`, and any custom header the operator's earlier middleware put on the request: all of them.\n\nThe fix commit for CVE-2026-41181 (`0fdea20e`, backported to the `v2.11.44`, `v3.6.15`, and `v3.7.0-rc.3` release branches) does not delete the `CopyHeaders` call. It wraps it:\n\n```diff\n-\tutils.CopyHeaders(pageReq.Header, req.Header)\n+\tif c.requestHeaders != nil {\n+\t\tfor _, header := range c.requestHeaders {\n+\t\t\tif values := req.Header.Values(header); len(values) > 0 {\n+\t\t\t\tpageReq.Header[http.CanonicalHeaderKey(header)] = values\n+\t\t\t}\n+\t\t}\n+\t} else {\n+\t\tutils.CopyHeaders(pageReq.Header, req.Header)\n+\t}\n```\n\nThe new `if`-branch is a per-header allowlist driven by a slice the operator declares as `errorRequestHeaders` in dynamic configuration. The `else`-branch is the original line. The branch the runtime takes is selected by whether `c.requestHeaders` is nil. The corresponding field, `ErrorPage.ErrorRequestHeaders` in `pkg/config/dynamic/middlewares.go`, is nil in every existing dynamic configuration in the world: the field did not exist before this commit. Existing deployments upgrade to the patched binary and run the `else`-branch on every error response that lands inside the configured status range.\n\n## The patch's test asserts `Bearer secret` is forwarded\n\nThe same commit appends three test cases to the table in `TestHandler`. The first reads:\n\n```go\n{\n desc: \"forward all headers by default\",\n errorPage: &dynamic.ErrorPage{Service: \"error\", Query: \"/test\", Status: []string{\"503\"}},\n requestHeaders: map[string]string{\n \"X-Request-Id\": \"trace-abc\",\n \"Authorization\": \"Bearer secret\",\n },\n backendCode: http.StatusServiceUnavailable,\n backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n fmt.Fprintln(w, r.Header.Get(\"X-Request-Id\"))\n fmt.Fprintln(w, r.Header.Get(\"Authorization\"))\n }),\n validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {\n t.Helper()\n assert.Contains(t, recorder.Body.String(), \"trace-abc\")\n assert.Contains(t, recorder.Body.String(), \"Bearer secret\")\n },\n},\n```\n\nThe case constructs an `ErrorPage` with no `ErrorRequestHeaders` field. It sends an inbound request carrying `Authorization: Bearer secret` and `X-Request-Id: trace-abc`. It writes a backend error handler that echoes both values into the response body, and asserts that both literal strings appear there. `assert.Contains(t, ..., \"Bearer secret\")` is the patch author's own statement, in code, of what the patched default does to bearer tokens. The patch did not break the prior behavior. The patch validated the prior behavior with a test that the project's test runner is now required to pass.\n\nThe Go struct comment in `middlewares.go`, added in the same commit, agrees with the test:\n\n```go\n// ErrorRequestHeaders defines the list of request headers forwarded to the error page service.\n// When nil (not set), all original request headers are forwarded.\n// Set to an empty list to forward no headers, or list specific headers to forward only those.\nErrorRequestHeaders []string `json:\"errorRequestHeaders,omitempty\" ...`\n```\n\nThe two remaining test cases added by the patch are named `forward only allowlisted headers` and `forward no headers`. The first sets `ErrorRequestHeaders: []string{\"X-Request-Id\"}` and asserts `assert.NotContains(t, recorder.Body.String(), \"Bearer secret\")`. The second sets `ErrorRequestHeaders: []string{}` (an empty slice, distinct from nil) and asserts the same. The `NotContains` assertion lives in the test file. It runs on the two new explicit-allowlist branches. It does not run on the default branch.\n\n## The pre-patch docs mentioned one header. The request carried the rest.\n\nThe Traefik v3 documentation page for the Errors middleware, in its pre-patch form, contains exactly one admonition about header forwarding. The admonition is keyed `\"Host Header\"`:\n\n```\n!!! info \"Host Header\"\n\n By default, the client `Host` header value is forwarded to the configured error\n service. To forward the `Host` value corresponding to the configured error service\n URL, the passHostHeader option must be set to `false`.\n```\n\nThe `Host` header is the header the page discusses because `Host` has a configuration knob attached, `passHostHeader`, that rewrites it. The admonition exists to explain the rewriting. It does not state that the rest of the inbound request's headers travel to the error-page service unchanged. The same page also says, on its second line, `The error page itself is _not_ hosted by Traefik.` An operator reading the page forms a reasonable model: the middleware sends a status-keyed request to a separate service, and the only inbound-request element the middleware forwards is `Host`, with documented rewriting subtleties for the operators who need them.\n\nThe model is wrong, and the model is the natural read of the page that lived on the documentation site until April 24, 2026. The page enumerates configurable options. `Host` is in the page only because `Host` has a configurable option to enumerate. The other headers are absent from the page because there was no knob to discuss, not because they were absent from the wire.\n\n## The patched docs say it out loud\n\nThe same commit adds a new subsection to `errorpages.md`, under the heading `### errorRequestHeaders`:\n\n```\nDefines the list of original request headers forwarded to the error page service.\n\nBy default (errorRequestHeaders not set), all request headers, including authentication\nmaterial such as Authorization and Cookie, are forwarded.\n\nIf the error page service is in a separate trust domain, use this option to restrict\nwhich headers cross the service boundary.\n```\n\nThe sentence beginning `By default` is the documentation the page should have carried for as long as the unconditional `CopyHeaders` line had been the codepath. Its placement is the only thing that makes it read as a feature note rather than as a security advisory: a reader sees it under the new option, framed as part of the new feature, rather than as the pre-existing risk the new feature mitigates.\n\nThe third sentence acknowledges, in Traefik's own framing, the trust boundary that justifies the option. The error-page service is something a deployment routes to. In Kubernetes deployments, it is a separate `Service`. In file-config deployments, it is a separate `services` block. In practice, an error-page service is most often a static file server, a small image with a small surface, sometimes operated by a different team or vendor than the backend that handed Traefik the 5xx in the first place. The patched docs' new sentence answers what it means for the credentials on the inbound request to cross that boundary by default: it should not have been the default to send them.\n\n## The migration note states what the patch did not change\n\nThe same commit appends to `docs/content/migration/v2.md`, under the heading `## v2.11.44`:\n\n```\nIn v2.11.44, a new errorRequestHeaders option has been added to the Errors middleware.\n\nBy default, the behavior is unchanged: all original request headers are forwarded to\nthe error page service.\n\nIf the error page service is in a separate trust domain, consider using\nerrorRequestHeaders to restrict which headers are forwarded.\n```\n\nThe middle sentence is the project's own statement of what `v2.11.44` did to the default. The GHSA database entry for CVE-2026-41181 (`GHSA-p6hg-qh38-555r`) lists `v2.11.44`, `v3.6.15`, and `v3.7.0-rc.3` as the fixed versions. Both statements are public record. The fixed versions ship the option. The fixed versions do not change the default. The CVE record's \"fixed in\" field and the migration note's \"behavior is unchanged\" sentence describe the same binary.\n\n## Wide default, narrow doc\n\nA forwarding component copies its entire inbound structure into its outbound call by default. The component's reference documentation enumerates the configurable surface. The configurable surface, before the CVE fix, contains the one element of the structure that has a knob attached. The other elements of the structure are present at runtime and absent from the page, because there is no knob to discuss. Operators read the docs and reason from the configurable surface. Their mental model of what crosses the boundary matches the enumerated knobs. The wire matches the unconditional copy.\n\nThe CVE record arrives and the fix adds an opt-in allowlist to the configurable surface. The same commit that adds the option adds the documentation paragraph that finally describes the default. The wide forwarding remains the default. The doc gap that obscured it closes; the bytes on the wire do not.\n\nThe same shape exists in any framework that propagates request context to downstream consumers. Webhook senders that POST the entire inbound payload by default. Log forwarders that dump the inbound request to a log sink. Error reporters whose default-included context contains the entire request. Metrics exporters that label timeseries with the entire header set. The documentation describes the knobs. The bytes on the wire are not the knobs.\n\nAn operator who upgrades Traefik to `v2.11.44` and does not read the migration note continues to run the test case named `forward all headers by default`. The test case is not in the operator's repository. It is in Traefik's. It passes.\n\nGHSA: [GHSA-p6hg-qh38-555r](https://github.com/advisories/GHSA-p6hg-qh38-555r). Fix commit: [`0fdea20e`](https://github.com/traefik/traefik/commit/0fdea20eb1e1e9c5c123283368a5124c37472f06).","closing_line":"The fix is the option. The default is the bug.","hook_md":"The patch for CVE-2026-41181 adds three test cases to Traefik's `pkg/middlewares/customerrors/custom_errors_test.go`. The first test is named `forward all headers by default`. It constructs an `ErrorPage` with no `ErrorRequestHeaders` field set, sends an inbound request carrying `Authorization: Bearer secret`, and asserts that the literal string `Bearer secret` appears in the request the Errors middleware forwards to the configured error-page service. The assertion is `assert.Contains`, not `assert.NotContains`. The test passes on the patched build. The default is the bug.","post_id":441,"slug":"traefik-cve-2026-41181-forward-all-headers-by-default","title":"CVE-2026-41181: Traefik's Patch Added A Test Named `forward all headers by default`. It Passes.","type":"initial","unreadable_sentence":"The patch did not break the prior behavior. The patch validated the prior behavior with a test that the project's test runner is now required to pass."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCamuU6gAKCRDeZjl4jgkQ JjUnAP9qOKOtGarpf+RRd8gn3GxsLe864ME0k1CxueIT3ViKIwD/T5yIeRXrGr2i J7lpPWb07Xju3G55ZKiGuuaWh91cQQM= =fKDj -----END PGP SIGNATURE-----