GHSA-wwh2-r387-g5rm: Tower http Path Traversal Vulnerability

MODERATE
CWE-22
Published
Advisory Summary

GHSA-wwh2-r387-g5rm is a MODERATE path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Tower http libraries in the crates.io ecosystem. The issue involves tower-http's improper validation of windows paths could lead to directory traversal attack. Remediation is available by upgrading affected packages to version 0.2.1, 0.1.3.

GHSA-wwh2-r387-g5rm at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-wwh2-r387-g5rm
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Tower http
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-wwh2-r387-g5rm

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

tower-http fixed: 0.2.1
Upgrade tower-http to 0.2.1
tower-http fixed: 0.1.3
Upgrade tower-http to 0.1.3
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 tower-http

How to Check if You Are Affected

To determine whether your application is affected by GHSA-wwh2-r387-g5rm, inspect your project dependencies for Tower http:

inspect dependencies for tower-http

Analyze the terminal output to locate any version of Tower http in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.1), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Tower http, 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

`tower_http::services::fs::ServeDir` didn't correctly validate Windows paths meaning paths like `/foo/bar/c:/windows/web/screen/img101.png` would be allowed and respond with the contents of `c:/windows/web/screen/img101.png`. Thus users could potentially read files anywhere on the filesystem. This only impacts Windows. Linux and other unix likes are not impacted by this.

GHSA-wwh2-r387-g5rm Affected Tower http Versions

2 component(s)
Fixed Versions:
0.2.10.1.3
Product / Package Ecosystem Affected Versions Fixed Version
tower-http
crates.io
≥ 0.2.0
< 0.2.1
0.2.1
tower-http
crates.io
< 0.1.3
0.1.3

References

Frequently Asked Questions

What is GHSA-wwh2-r387-g5rm?
GHSA-wwh2-r387-g5rm is a security vulnerability in Tower http involving tower-http's improper validation of Windows paths could lead to directory traversal attack under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Tower http versions are affected?
Affected versions include releases prior to 0.2.1, 0.1.3 across affected packages: tower-http.
What version fixes GHSA-wwh2-r387-g5rm?
Upgrading to 0.2.1, 0.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tower-http affected?
Yes, tower-http is affected in releases prior to 0.2.1, 0.1.3. Upgrade your dependency to 0.2.1, 0.1.3 or later.
What CWE is associated with GHSA-wwh2-r387-g5rm?
GHSA-wwh2-r387-g5rm is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check crates.io dependencies for GHSA-wwh2-r387-g5rm?
Run the dependency tree command: 'inspect dependencies for tower-http'. 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-wwh2-r387-g5rm",
  "modified" : "2023-06-13T22:06:25Z",
  "published" : "2022-06-17T00:26:05Z",
  "aliases" : [ ],
  "summary" : "tower-http's improper validation of Windows paths could lead to directory traversal attack",
  "details" : "`tower_http::services::fs::ServeDir` didn't correctly validate Windows paths meaning paths like `/foo/bar/c:/windows/web/screen/img101.png` would be allowed and respond with the contents of `c:/windows/web/screen/img101.png`. Thus users could potentially read files anywhere on the filesystem. This only impacts Windows. Linux and other unix likes are not impacted by this.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tower-http"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.2.0"
      }, {
        "fixed" : "0.2.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tower-http"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tower-rs/tower-http/pull/204"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tower-rs/tower-http"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2021-0135.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T00:26:05Z",
    "nvd_published_at" : null
  }
}