# GHSA-qrqq-9c63-xfrg: tower-http's improper validation of Windows paths could lead to directory traversal attack

> An attacker can read arbitrary files on Windows systems via directory traversal in tower-http's ServeDir service.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Jan 2022
- **Also known as:** RUSTSEC-2022-0043

## What is GHSA-qrqq-9c63-xfrg?

GHSA-qrqq-9c63-xfrg is a path traversal vulnerability in tower-http, published on 21 Jan 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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

See [tower-http#204] for more details.

[tower-http#204]: https://github.com/tower-rs/tower-http/pull/204

## Which versions are affected by GHSA-qrqq-9c63-xfrg?

5 open source packages ship an affected version, including tower-http.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tower-http` | crates.io | All versions | 0.1.3 |
| `tower-http` | crates.io | All versions | 0.1.3 |
| `tower-http` | crates.io | From 0.0.0-0 | 0.1.3, 0.2.1 |
| `tower-http` | crates.io | From 0.2.0 | 0.2.1 |
| `tower-http` | crates.io | From 0.2.0 | 0.2.1 |

## How do I fix GHSA-qrqq-9c63-xfrg?

Upgrade tower-http to a fixed version for your release line: 0.1.3 or 0.2.1.

## Is GHSA-qrqq-9c63-xfrg being exploited?

There is no known exploitation of GHSA-qrqq-9c63-xfrg in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-qrqq-9c63-xfrg and fix it if it is affected.

What it is: GHSA-qrqq-9c63-xfrg is a path traversal vulnerability in tower-http, published on 21 Jan 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-qrqq-9c63-xfrg in the wild and no public exploit code.

Affected packages and fixed versions:
- tower-http (crates.io): affected all versions; fixed in 0.1.3
- tower-http (crates.io): affected all versions; fixed in 0.1.3
- tower-http (crates.io): affected from 0.0.0-0; fixed in 0.1.3, 0.2.1
- tower-http (crates.io): affected from 0.2.0; fixed in 0.2.1
- tower-http (crates.io): affected from 0.2.0; fixed in 0.2.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-qrqq-9c63-xfrg/ (Markdown: https://insights.sbomify.com/GHSA-qrqq-9c63-xfrg/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-qrqq-9c63-xfrg

---
From sbomify Insights: https://insights.sbomify.com/GHSA-qrqq-9c63-xfrg/
Summaries are generated and may contain mistakes; the official description above is the record.
