CVE-2026-54764: Traefik ForwardAuth Middleware Leaks X-Forwarded-Port Spoofing Vulnerability

MODERATE
Advisory Identifier: GHSA-3q9r-p662-5j8m
CVSS 5.8
CWE-345
Published
Advisory Summary

CVE-2026-54764 is a MODERATE (CVSS 5.8) forwardauth middleware leaks x-forwarded-port spoofing vulnerability (CWE-345: Insufficient Verification of Data Authenticity) affecting Traefik libraries in the Go ecosystem. The issue involves forwardauth middleware leaks x-forwarded-port spoofing via untrusted x-forwarded-proto when trustforwardheader=false. Remediation is available by upgrading affected packages to version 2.11.51, 3.6.22, 3.7.6.

CVE-2026-54764 at a Glance

CVE Identifier CVE-2026-54764
GHSA Identifier GHSA-3q9r-p662-5j8m
Severity MODERATE
CVSS v3.1 Base Score 5.8
CWE Classification CWE-345: Insufficient Verification of Data Authenticity
Affected Product Traefik
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.8

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:C/C:N/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-54764

To remediate this vulnerability, upgrade all affected Traefik dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/traefik/traefik/v2 fixed: 2.11.51
Upgrade github.com/traefik/traefik/v2 to 2.11.51
github.com/traefik/traefik/v3 fixed: 3.6.22
Upgrade github.com/traefik/traefik/v3 to 3.6.22
github.com/traefik/traefik/v3 fixed: 3.7.6
Upgrade github.com/traefik/traefik/v3 to 3.7.6
github.com/traefik/traefik fixed: Latest secure release
Upgrade github.com/traefik/traefik to Latest secure release
Verify Direct and Transitive Dependencies

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/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-54764, inspect your project dependencies for Traefik:

inspect dependencies for github.com/traefik/traefik/v2

Analyze the terminal output to locate any version of Traefik in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.11.51), 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-345: Insufficient Verification of Data Authenticity, where the product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data. In Traefik, 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

## Summary There is a medium severity vulnerability in Traefik's ForwardAuth middleware. Even when configured with `trustForwardHeader: false`, Traefik derives the `X-Forwarded-Port` header sent to the authentication service from the original incoming request instead of the sanitized forwarded request. As a result, an unauthenticated remote attacker can inject an `X-Forwarded-Proto: https` header over a plain HTTP connection and cause Traefik to forward `X-Forwarded-Port: 443` to the auth service, bypassing port-based authorization checks. This is a regression of the incomplete fix for GHSA-6384-m2mw-rf54, which addressed the `X-Forwarded-Proto` and `X-Forwarded-Prefix` spoofing vectors but missed the `X-Forwarded-Port` vector. ## Patches - https://github.com/traefik/traefik/releases/tag/v2.11.51 - https://github.com/traefik/traefik/releases/tag/v3.6.22 - https://github.com/traefik/traefik/releases/tag/v3.7.6 ## 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 ForwardAuth middleware, even when configured with `trustForwardHeader: false`, still derives the `X-Forwarded-Port` header sent to the authentication service by reading the **attacker-controlled** `X-Forwarded-Proto` header from the original incoming request. This allows an unauthenticated remote attacker to cause Traefik to forward `X-Forwarded-Port: 443` to the auth service on a plain HTTP connection, creating an inconsistency that can bypass port-based authorization checks. ### Details The fix introduced in commit `5e1de2258` (released as part of the April 2026 security advisory GHSA-6384-m2mw-rf54) correctly strips all X-Forwarded-* headers from the forwarded auth request when `trustForwardHeader=false`, and reconstructs `X-Forwarded-Proto` from the actual TLS state of the connection (`req.TLS`). However, the reconstruction of `X-Forwarded-Port` is delegated to the helper `forwardedPort(req)` which receives the **original request** (`req`) rather than the sanitized forward request (`forwardReq`): ```go // pkg/middlewares/auth/forward.go – writeHeader() if !trustForwardHeader { forwardedheaders.DeleteXForwardedHeaders(forwardReq.Header) // strips all X-Fwd-* from forwardReq } // ... if _, ok := forwardReq.Header[forwardedheaders.XForwardedPort]; !ok { forwardReq.Header.Set(forwardedheaders.XForwardedPort, forwardedPort(req)) // ← req = ORIGINAL } // pkg/middlewares/auth/forward.go – forwardedPort() func forwardedPort(req *http.Request) string { if _, port, err := net.SplitHostPort(req.Host); err == nil && port != "" { return port } // Reads attacker-controlled header on the ORIGINAL request: if req.Header.Get(forwardedheaders.XForwardedProto) == "https" || ... { return "443" } if req.TLS != nil { return "443" } return "80" } Result when trustForwardHeader=false and attacker sends X-Forwarded-Proto: https on a plain HTTP connection: ┌──────────────────────────────────┬──────────┬────────┐ │ Header forwarded to auth service │ Expected │ Actual │ ├──────────────────────────────────┼──────────┼────────┤ │ X-Forwarded-Proto │ http │ http ✓ │ ├──────────────────────────────────┼──────────┼────────┤ │ X-Forwarded-Port │ 80 │ 443 ✗ │ └──────────────────────────────────┴──────────┴────────┘ ``` The inconsistency between Proto=http and Port=443 is exploitable against any authentication service that gates access based on X-Forwarded-Port. ### PoC Traefik configuration: ```http: middlewares: my-auth: forwardAuth: address: "http://auth-service/" trustForwardHeader: false # security setting, but still bypassable routers: api: rule: "PathPrefix(`/api`)" middlewares: - my-auth service: backend Auth service logic (example victim): # auth-service checks: only port 443 requests are considered "secure" port = request.headers.get("X-Forwarded-Port", "80") proto = request.headers.get("X-Forwarded-Proto", "http") if port == "443": return 200 # grant access return 403 ``` Attack: Plain HTTP connection, no TLS – but spoofs port 443 curl -H "X-Forwarded-Proto: https" http://traefik.example.com/api/admin Auth service receives X-Forwarded-Port: 443 → grants access Verification: Enable Traefik debug logging and observe X-Forwarded-Port: 443 in the auth request while the connection is plain HTTP. ### Impact Any deployment using the ForwardAuth middleware with trustForwardHeader: false where the downstream authentication service uses X-Forwarded-Port to make authorization decisions is vulnerable to privilege escalation. An unauthenticated attacker can bypass port-based security checks (e.g., "only allow requests arriving on HTTPS port 443") by injecting a single X-Forwarded-Proto: https header on a plain HTTP connection. This is a regression of the incomplete fix for GHSA-6384-m2mw-rf54: while the X-Forwarded-Prefix and X-Forwarded-Proto spoofing vectors were addressed, the X-Forwarded-Port vector was missed. </details> ---

CVE-2026-54764 Affected Traefik Versions

4 component(s)
Fixed Versions:
2.11.513.6.223.7.6
Product / Package Ecosystem Affected Versions Fixed Version
github.com/traefik/traefik/v2
Go
< 2.11.51
2.11.51
github.com/traefik/traefik/v3
Go
< 3.6.22
3.6.22
github.com/traefik/traefik/v3
Go
≥ 3.7.0
< 3.7.6
3.7.6
github.com/traefik/traefik
Go
≤ 1.7.34

References

Frequently Asked Questions

What is CVE-2026-54764?
CVE-2026-54764 is a security vulnerability in Traefik involving ForwardAuth middleware leaks X-Forwarded-Port spoofing via untrusted X-Forwarded-Proto when trustForwardHeader=false under CWE-345: Insufficient Verification of Data Authenticity.
Which Traefik versions are affected?
Affected versions include releases prior to 2.11.51, 3.6.22, 3.7.6 across affected packages: github.com/traefik/traefik/v2, github.com/traefik/traefik/v3, github.com/traefik/traefik.
What version fixes CVE-2026-54764?
Upgrading to 2.11.51, 3.6.22, 3.7.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/traefik/traefik/v2 affected?
Yes, github.com/traefik/traefik/v2 is affected in releases prior to 2.11.51. Upgrade your dependency to 2.11.51 or later.
Is github.com/traefik/traefik/v3 affected?
Yes, github.com/traefik/traefik/v3 is affected in releases prior to 3.6.22, 3.7.6. Upgrade your dependency to 3.6.22, 3.7.6 or later.
What is the CVSS score of CVE-2026-54764?
CVE-2026-54764 has a CVSS v3.1 base score of 5.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N.
What CWE is associated with CVE-2026-54764?
CVE-2026-54764 is classified under CWE-345: Insufficient Verification of Data Authenticity (The product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.).
How can I check Go dependencies for CVE-2026-54764?
Run the dependency tree command: 'inspect dependencies for github.com/traefik/traefik/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3q9r-p662-5j8m",
  "modified" : "2026-08-06T16:38:29Z",
  "published" : "2026-08-06T16:38:29Z",
  "aliases" : [ "CVE-2026-54764" ],
  "summary" : "Traefik: ForwardAuth middleware leaks X-Forwarded-Port spoofing via untrusted X-Forwarded-Proto when trustForwardHeader=false",
  "details" : "## Summary\n\nThere is a medium severity vulnerability in Traefik's ForwardAuth middleware. Even when configured with `trustForwardHeader: false`, Traefik derives the `X-Forwarded-Port` header sent to the authentication service from the original incoming request instead of the sanitized forwarded request. As a result, an unauthenticated remote attacker can inject an `X-Forwarded-Proto: https` header over a plain HTTP connection and cause Traefik to forward `X-Forwarded-Port: 443` to the auth service, bypassing port-based authorization checks. This is a regression of the incomplete fix for GHSA-6384-m2mw-rf54, which addressed the `X-Forwarded-Proto` and `X-Forwarded-Prefix` spoofing vectors but missed the `X-Forwarded-Port` vector.\n\n## Patches\n\n- https://github.com/traefik/traefik/releases/tag/v2.11.51\n- https://github.com/traefik/traefik/releases/tag/v3.6.22\n- https://github.com/traefik/traefik/releases/tag/v3.7.6\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### Summary\n\n  The ForwardAuth middleware, even when configured with `trustForwardHeader: false`,\n  still derives the `X-Forwarded-Port` header sent to the authentication service by\n  reading the **attacker-controlled** `X-Forwarded-Proto` header from the original\n  incoming request. This allows an unauthenticated remote attacker to cause Traefik\n  to forward `X-Forwarded-Port: 443` to the auth service on a plain HTTP connection,\n  creating an inconsistency that can bypass port-based authorization checks.\n\n  ### Details\n\n  The fix introduced in commit `5e1de2258` (released as part of the April 2026 security\n  advisory GHSA-6384-m2mw-rf54) correctly strips all X-Forwarded-* headers from the\n  forwarded auth request when `trustForwardHeader=false`, and reconstructs\n  `X-Forwarded-Proto` from the actual TLS state of the connection (`req.TLS`).\n\n  However, the reconstruction of `X-Forwarded-Port` is delegated to the helper\n  `forwardedPort(req)` which receives the **original request** (`req`) rather than\n  the sanitized forward request (`forwardReq`):\n\n  ```go\n  // pkg/middlewares/auth/forward.go – writeHeader()\n  if !trustForwardHeader {\n      forwardedheaders.DeleteXForwardedHeaders(forwardReq.Header) // strips all X-Fwd-* from forwardReq\n  }\n  // ...\n  if _, ok := forwardReq.Header[forwardedheaders.XForwardedPort]; !ok {\n      forwardReq.Header.Set(forwardedheaders.XForwardedPort, forwardedPort(req)) // ← req = ORIGINAL\n  }\n\n  // pkg/middlewares/auth/forward.go – forwardedPort()\n  func forwardedPort(req *http.Request) string {\n      if _, port, err := net.SplitHostPort(req.Host); err == nil && port != \"\" {\n          return port\n      }\n      // Reads attacker-controlled header on the ORIGINAL request:\n      if req.Header.Get(forwardedheaders.XForwardedProto) == \"https\" || ... {\n          return \"443\"\n      }\n      if req.TLS != nil {\n          return \"443\"\n      }\n      return \"80\"\n  }\n\n  Result when trustForwardHeader=false and attacker sends X-Forwarded-Proto: https\n  on a plain HTTP connection:\n\n  ┌──────────────────────────────────┬──────────┬────────┐\n  │ Header forwarded to auth service │ Expected │ Actual │\n  ├──────────────────────────────────┼──────────┼────────┤\n  │ X-Forwarded-Proto                │ http     │ http ✓ │\n  ├──────────────────────────────────┼──────────┼────────┤\n  │ X-Forwarded-Port                 │ 80       │ 443 ✗  │\n  └──────────────────────────────────┴──────────┴────────┘\n```\n  The inconsistency between Proto=http and Port=443 is exploitable against any\n  authentication service that gates access based on X-Forwarded-Port.\n\n  ### PoC\n\n  Traefik configuration:\n\n  ```http:\n    middlewares:\n      my-auth:\n        forwardAuth:\n          address: \"http://auth-service/\"\n          trustForwardHeader: false  # security setting, but still bypassable\n    routers:\n      api:\n        rule: \"PathPrefix(`/api`)\"\n        middlewares:\n          - my-auth\n        service: backend\n\n  Auth service logic (example victim):\n  # auth-service checks: only port 443 requests are considered \"secure\"\n  port = request.headers.get(\"X-Forwarded-Port\", \"80\")\n  proto = request.headers.get(\"X-Forwarded-Proto\", \"http\")\n  if port == \"443\":\n      return 200  # grant access\n  return 403\n```\n  Attack:\n\n  Plain HTTP connection, no TLS – but spoofs port 443\n  curl -H \"X-Forwarded-Proto: https\" http://traefik.example.com/api/admin\n  Auth service receives X-Forwarded-Port: 443 → grants access\n\n  Verification: Enable Traefik debug logging and observe X-Forwarded-Port: 443\n  in the auth request while the connection is plain HTTP.\n\n ### Impact\n\n  Any deployment using the ForwardAuth middleware with trustForwardHeader: false where\n  the downstream authentication service uses X-Forwarded-Port to make authorization\n  decisions is vulnerable to privilege escalation. An unauthenticated attacker can\n  bypass port-based security checks (e.g., \"only allow requests arriving on HTTPS port\n  443\") by injecting a single X-Forwarded-Proto: https header on a plain HTTP\n  connection.\n\n  This is a regression of the incomplete fix for GHSA-6384-m2mw-rf54: while the\n  X-Forwarded-Prefix and X-Forwarded-Proto spoofing vectors were addressed, the\n  X-Forwarded-Port vector was missed.\n\n</details>\n\n---",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/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:N/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/traefik/traefik/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.11.51"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.11.50"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/traefik/traefik/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.6.22"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.6.21"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/traefik/traefik/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.7.0"
      }, {
        "fixed" : "3.7.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.7.5"
    }
  }, {
    "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-3q9r-p662-5j8m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-54764"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/pull/13344"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/commit/7ae92d8c2c10ac04ef5a03df0ed5019ce0f44b2d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/traefik/traefik"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/releases/tag/v2.11.51"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/releases/tag/v3.6.22"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/releases/tag/v3.7.6"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-345" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-06T16:38:29Z",
    "nvd_published_at" : "2026-07-06T21:16:56Z"
  }
}