CVE-2026-54764

CVE-2026-54764 is a medium-severity security vulnerability in github.com/traefik/traefik/v2 (go), affecting versions <= 2.11.50. It is fixed in 2.11.51, 3.6.22, 3.7.6.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Traefik: ForwardAuth middleware leaks X-Forwarded-Port spoofing via untrusted X-Forwarded-Proto when trustForwardHeader=false

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.

For more information

If you have any questions or comments about this advisory, please open an issue.

Original Description

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):

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

  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.

Impact

CVE-2026-54764 has a CVSS score of 5.8 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.11.51, 3.6.22, 3.7.6); upgrading removes the vulnerable code path.

Affected versions

github.com/traefik/traefik/v2 (<= 2.11.50) github.com/traefik/traefik/v3 (<= 3.6.21) github.com/traefik/traefik/v3 (>= 3.7.0, <= 3.7.5) github.com/traefik/traefik (<= 1.7.34)

Security releases

github.com/traefik/traefik/v2 → 2.11.51 (go) github.com/traefik/traefik/v3 → 3.6.22 (go) github.com/traefik/traefik/v3 → 3.7.6 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Frequently Asked Questions

  1. What is CVE-2026-54764? CVE-2026-54764 is a medium-severity security vulnerability in github.com/traefik/traefik/v2 (go), affecting versions <= 2.11.50. It is fixed in 2.11.51, 3.6.22, 3.7.6.
  2. How severe is CVE-2026-54764? CVE-2026-54764 has a CVSS score of 5.8 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which packages are affected by CVE-2026-54764?
    • github.com/traefik/traefik/v2 (go) (versions <= 2.11.50)
    • github.com/traefik/traefik/v3 (go) (versions <= 3.6.21)
    • github.com/traefik/traefik (go) (versions <= 1.7.34)
  4. Is there a fix for CVE-2026-54764? Yes. CVE-2026-54764 is fixed in 2.11.51, 3.6.22, 3.7.6. Upgrade to this version or later.
  5. Is CVE-2026-54764 exploitable, and should I be worried? Whether CVE-2026-54764 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-54764 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-54764?
    • Upgrade github.com/traefik/traefik/v2 to 2.11.51 or later
    • Upgrade github.com/traefik/traefik/v3 to 3.6.22 or later
    • Upgrade github.com/traefik/traefik/v3 to 3.7.6 or later

Other vulnerabilities in github.com/traefik/traefik/v2

Stop the waste.
Protect your environment with Kodem.