CVE-2023-47106: Github.com/traefik/traefik/v2 Traefik Incorrectly Processes Fragment Vulnerability

MODERATE
Advisory Identifier: GHSA-fvhj-4qfh-q2hm
CVSS 6.5
CWE-20 CWE-177
Published
Advisory Summary

CVE-2023-47106 is a MODERATE (CVSS 6.5) traefik incorrectly processes fragment vulnerability (CWE-20: Improper Input Validation) affecting Github.com/traefik/traefik/v2 libraries in the Go ecosystem. The issue involves traefik incorrectly processes fragment in the url, leads to authorization bypass. Remediation is available by upgrading affected packages to version 2.10.6, 3.0.0-beta5.

CVE-2023-47106 at a Glance

CVE Identifier CVE-2023-47106
GHSA Identifier GHSA-fvhj-4qfh-q2hm
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/traefik/traefik/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

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:L/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 Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-47106

To remediate this vulnerability, upgrade all affected Github.com/traefik/traefik/v2 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.10.6
Upgrade github.com/traefik/traefik/v2 to 2.10.6
github.com/traefik/traefik/v3 fixed: 3.0.0-beta5
Upgrade github.com/traefik/traefik/v3 to 3.0.0-beta5
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-2023-47106, inspect your project dependencies for Github.com/traefik/traefik/v2:

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

Analyze the terminal output to locate any version of Github.com/traefik/traefik/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.10.6), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Github.com/traefik/traefik/v2, 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 When a request is sent to Traefik with a URL fragment, Traefik automatically URL encodes and forwards the fragment to the backend server. This violates the RFC because in the origin-form the URL should only contain the absolute path and the query. When this is combined with another frontend proxy like Nginx, it can be used to bypass frontend proxy URI-based access control restrictions. ### Details For example, we have this Nginx configuration: ``` location /admin { deny all; return 403; } ``` This can be bypassed when the attacker is requesting to /#/../admin This won’t be vulnerable if the backend server follows the RFC and ignores any characters after the fragment. However, if Nginx is chained with another reverse proxy which automatically URL encode the character # (Traefik) the URL will become /%23/../admin And allow the attacker to completely bypass the Access Restriction from the Nginx Front-End proxy. Here is a diagram to summarize the attack: ![image](https://user-images.githubusercontent.com/47447167/278849578-34ca0546-99b4-44c8-8fc8-8e799c1f5069.png) ### PoC ![image (1)](https://user-images.githubusercontent.com/47447167/278849597-280f2e80-f2d7-4dd9-9662-b8f488fd5ff2.png) This is the POC docker I've set up. It contains Nginx, Traefik proxies and a backend server running PHP. https://drive.google.com/file/d/1vLnA0g7N7ZKhLNmHmuJ4JJjV_J2akNMt/view?usp=sharing ### Impact This allows the attacker to completely bypass the Access Restriction from Front-End proxy.

CVE-2023-47106 Affected Github.com/traefik/traefik/v2 Versions

2 component(s)
Fixed Versions:
2.10.63.0.0-beta5
Product / Package Ecosystem Affected Versions Fixed Version
github.com/traefik/traefik/v2
Go
< 2.10.6
2.10.6
github.com/traefik/traefik/v3
Go
< 3.0.0-beta5
3.0.0-beta5

References

Frequently Asked Questions

What is CVE-2023-47106?
CVE-2023-47106 is a security vulnerability in Github.com/traefik/traefik/v2 involving Traefik incorrectly processes fragment in the URL, leads to Authorization Bypass under CWE-20: Improper Input Validation.
Which Github.com/traefik/traefik/v2 versions are affected?
Affected versions include releases prior to 2.10.6, 3.0.0-beta5 across affected packages: github.com/traefik/traefik/v2, github.com/traefik/traefik/v3.
What version fixes CVE-2023-47106?
Upgrading to 2.10.6, 3.0.0-beta5 (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.10.6. Upgrade your dependency to 2.10.6 or later.
Is github.com/traefik/traefik/v3 affected?
Yes, github.com/traefik/traefik/v3 is affected in releases prior to 3.0.0-beta5. Upgrade your dependency to 3.0.0-beta5 or later.
What is the CVSS score of CVE-2023-47106?
CVE-2023-47106 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2023-47106?
CVE-2023-47106 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Go dependencies for CVE-2023-47106?
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-fvhj-4qfh-q2hm",
  "modified" : "2023-12-07T23:06:09Z",
  "published" : "2023-12-05T18:11:48Z",
  "aliases" : [ "CVE-2023-47106" ],
  "summary" : "Traefik incorrectly processes fragment in the URL, leads to Authorization Bypass",
  "details" : "### Summary\nWhen a request is sent to Traefik with a URL fragment, Traefik automatically URL encodes and forwards the fragment to the backend server. This violates the RFC because in the origin-form the URL should only contain the absolute path and the query.\n\nWhen this is combined with another frontend proxy like Nginx, it can be used to bypass frontend proxy URI-based access control\nrestrictions. \n\n### Details\nFor example, we have this Nginx configuration:\n\n```\nlocation /admin {\n     deny all;\n     return 403;\n}\n```\nThis can be bypassed when the attacker is requesting to /#/../admin\n\nThis won’t be vulnerable if the backend server follows the RFC and ignores any characters after the fragment.\n\nHowever, if Nginx is chained with another reverse proxy which automatically URL encode the character # (Traefik) the URL will become\n\n/%23/../admin\n\nAnd allow the attacker to completely bypass the Access Restriction from the Nginx Front-End proxy.\n\nHere is a diagram to summarize the attack:\n\n![image](https://user-images.githubusercontent.com/47447167/278849578-34ca0546-99b4-44c8-8fc8-8e799c1f5069.png)\n\n### PoC\n![image (1)](https://user-images.githubusercontent.com/47447167/278849597-280f2e80-f2d7-4dd9-9662-b8f488fd5ff2.png)\n\nThis is the POC docker I've set up.  It contains Nginx, Traefik proxies and a backend server running PHP.\n\nhttps://drive.google.com/file/d/1vLnA0g7N7ZKhLNmHmuJ4JJjV_J2akNMt/view?usp=sharing\n\n### Impact\nThis allows the attacker to completely bypass the Access Restriction from Front-End proxy.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/traefik/traefik/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.10.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/traefik/traefik/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.0-beta5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/security/advisories/GHSA-fvhj-4qfh-q2hm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-47106"
  }, {
    "type" : "WEB",
    "url" : "https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/traefik/traefik"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/releases/tag/v2.10.6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/traefik/traefik/releases/tag/v3.0.0-beta5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-177", "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-12-05T18:11:48Z",
    "nvd_published_at" : "2023-12-04T21:15:33Z"
  }
}