CVE-2026-40912: Github.com/traefik/traefik/v3 Traefik Has An StripPrefixRegex Middleware Vulnerability
HIGHCVE-2026-40912 is a HIGH (CVSS 8.2) traefik has an stripprefixregex middleware vulnerability (CWE-706: Use of Incorrectly-Resolved Name or Reference) affecting Github.com/traefik/traefik/v3 libraries in the Go ecosystem. The issue involves traefik has an stripprefixregex middleware authorization bypass via path/rawpath desync. Remediation is available by upgrading affected packages to version 3.7.0-rc.2, 3.6.14, 2.11.43.
CVE-2026-40912 at a Glance
Security Impact
CVSS: 8.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N).
How to Fix CVE-2026-40912
To remediate this vulnerability, upgrade all affected Github.com/traefik/traefik/v3 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/traefik/traefik/v3 to 3.7.0-rc.2
Upgrade github.com/traefik/traefik/v3 to 3.6.14
Upgrade github.com/traefik/traefik/v2 to 2.11.43
Upgrade github.com/traefik/traefik to Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/traefik/traefik/v3
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-40912, inspect your project dependencies for Github.com/traefik/traefik/v3:
inspect dependencies for github.com/traefik/traefik/v3
Analyze the terminal output to locate any version of Github.com/traefik/traefik/v3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.7.0-rc.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-706: Use of Incorrectly-Resolved Name or Reference, where the product uses a name or reference to access a resource, but the name/reference resolves to a resource that is outside of the intended control sphere. In Github.com/traefik/traefik/v3, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-40912 Affected Github.com/traefik/traefik/v3 Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/traefik/traefik/v3
|
Go |
≥ 3.7.0-ea.1
< 3.7.0-rc.2
|
3.7.0-rc.2
|
|
github.com/traefik/traefik/v3
|
Go |
≥ 3.0.0-beta1
< 3.6.14
|
3.6.14
|
|
github.com/traefik/traefik/v2
|
Go |
< 2.11.43
|
2.11.43
|
|
github.com/traefik/traefik
|
Go |
≤ 1.7.34
|
|
References
Frequently Asked Questions
What is CVE-2026-40912?
Which Github.com/traefik/traefik/v3 versions are affected?
What version fixes CVE-2026-40912?
Is github.com/traefik/traefik/v3 affected?
Is github.com/traefik/traefik/v2 affected?
What is the CVSS score of CVE-2026-40912?
What CWE is associated with CVE-2026-40912?
How can I check Go dependencies for CVE-2026-40912?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6jwx-7vp4-9847",
"modified" : "2026-07-21T13:44:35Z",
"published" : "2026-04-24T16:37:53Z",
"aliases" : [ "CVE-2026-40912" ],
"summary" : "Traefik has an StripPrefixRegex Middleware Authorization Bypass via Path/RawPath Desync",
"details" : "## Summary\n\nThere is a high severity authentication bypass vulnerability in Traefik's `StripPrefixRegex` middleware when used in combination with `ForwardAuth`, `BasicAuth`, or `DigestAuth`.\n\nThe middleware matches the regex against the decoded URL path but uses the resulting byte length to slice the percent-encoded raw path. When a dot (or multiple dots) appears in the prefix portion of the URL, the raw path after stripping becomes a dot-segment (e.g. `/./admin/secret`).\n\n`ForwardAuth` receives this dot-segment path in `X-Forwarded-Uri`, which does not match the protected path patterns and therefore allows the request through. The backend then normalizes the dot-segment to the real path per RFC 3986 and serves the protected content\n\n An unauthenticated attacker can exploit this against any backend that performs dot-segment normalization.\n\n## Patches\n\n- https://github.com/traefik/traefik/releases/tag/v2.11.43\n- https://github.com/traefik/traefik/releases/tag/v3.6.14\n- https://github.com/traefik/traefik/releases/tag/v3.7.0-rc.2\n\n## For more information\n\nIf there are 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### Summary\n\n StripPrefixRegex uses the byte length of a decoded Path match to slice the encoded RawPath. When percent-encoded characters are in the prefix region, this produces a wrong RawPath. ForwardAuth then\n receives this wrong path in X-Forwarded-Uri, sees a path that doesn't match its protection rules, and approves the request. The backend serves protected content.\n\n ### Details\n\n `pkg/middlewares/stripprefixregex/strip_prefix_regex.go`, line 62:\n\n ```go\n req.URL.RawPath = ensureLeadingSlash(req.URL.RawPath[len(prefix):])\n```\n\n prefix comes from matching the regex against the decoded req.URL.Path (line 51). len(prefix) is then used to index into the encoded req.URL.RawPath. These lengths don't match when percent-encoding is\n present.\n\n Example with regex ^/api:\n\n - GET /api%20/admin/secret\n - Decoded Path: /api /admin/secret -> prefix = /api (4 bytes)\n - Encoded RawPath: /api%20/admin/secret -> same region is 6 bytes\n - RawPath[4:] = %20/admin/secret -> after ensureLeadingSlash -> /%20/admin/secret\n - ForwardAuth sees X-Forwarded-Uri: /%20/admin/secret -> not /admin/* -> allows it\n - Backend serves the protected admin content\n\n PoC\n\n Requires Docker and Docker Compose. I have a setup that runs Traefik v3.6.11 with StripPrefixRegex + ForwardAuth + a backend. It sends a normal request (blocked, 403) and an encoded request (bypasses\n auth, 200, returns protected data). Can share the files here if useful.\n\n Impact\n\n Auth bypass. Any path protected by ForwardAuth, BasicAuth, or DigestAuth can be accessed without credentials when StripPrefixRegex is in the same middleware chain. The attacker only needs to add a\n percent-encoded character to the prefix portion of the URL.\n\n---\n\n### Updated PoC (reporter follow-up)\n\nAfter further testing, the confirmed working exploit uses `%2e` (percent-encoded dot) rather than `%20`. Dot-segment normalization (`/./` -> `/`) is RFC 3986 standard behavior handled automatically by Express.js, Go's `http.ServeMux`, Spring Boot, and others — no custom configuration needed.\n\nChain:\n\n```\nGET /api%2e/admin/secret\n-> StripPrefixRegex strips /api -> RawPath becomes /./admin/secret\n-> ForwardAuth sees /./admin/secret -> does not match /admin/ -> allows\n-> Express normalizes /./admin/secret -> /admin/secret -> serves protected content\n```\n\nResults (Traefik v3.6, unmodified Express.js express.static):\n\n```\nGET /api/admin/secret -> 403 (blocked)\nGET /api%2e/admin/secret -> 200 (bypass — served protected content)\nGET /api%20/admin/secret -> 404 (space not normalized by backend)\n```\n\nAuth server logs:\n\n```\nX-Forwarded-Uri: '/admin/secret' -> DENIED\nX-Forwarded-Uri: '/./admin/secret' -> ALLOWED\n```\n\nReproduction:\n\n```bash\ndocker compose up -d --build --wait\ncurl http://localhost:8080/api/admin/secret # -> 403\ncurl --path-as-is \"http://localhost:8080/api%2e/admin/secret\" # -> 200\n```\n\n</details>\n\n---",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/traefik/traefik/v3"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.7.0-ea.1"
}, {
"fixed" : "3.7.0-rc.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/traefik/traefik/v3"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0-beta1"
}, {
"fixed" : "3.6.14"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/traefik/traefik/v2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.11.43"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/traefik/traefik"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "1.7.34"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/traefik/traefik/security/advisories/GHSA-6jwx-7vp4-9847"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40912"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/errata/RHSA-2026:21772"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/security/cve/CVE-2026-40912"
}, {
"type" : "WEB",
"url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2464229"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/traefik/traefik"
}, {
"type" : "WEB",
"url" : "https://github.com/traefik/traefik/releases/tag/v2.11.43"
}, {
"type" : "WEB",
"url" : "https://github.com/traefik/traefik/releases/tag/v3.6.14"
}, {
"type" : "WEB",
"url" : "https://github.com/traefik/traefik/releases/tag/v3.7.0-rc.2"
}, {
"type" : "WEB",
"url" : "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40912.json"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22", "CWE-706" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-24T16:37:53Z",
"nvd_published_at" : "2026-04-30T21:16:32Z"
}
}