# CVE-2024-35197: gix refs and paths with reserved Windows device names access the devices

> Attackers can cause denial of service or arbitrary output by using reserved Windows device names in Git repository paths or refs.

- **Severity:** Medium 5.4 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 23 May 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-49jc-r788-3fc9, RUSTSEC-2024-0351, RUSTSEC-2024-0352, RUSTSEC-2024-0353

## What is CVE-2024-35197?

CVE-2024-35197 is a medium-severity path traversal vulnerability in Byron gitoxide, published on 23 May 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

gitoxide is a pure Rust implementation of Git. On Windows, fetching refs that clash with legacy device names reads from the devices, and checking out paths that clash with such names writes arbitrary data to the devices. This allows a repository, when cloned, to cause indefinite blocking or the production of arbitrary message that appear to have come from the application, and potentially other harmful effects under limited circumstances. If Windows is not used, or untrusted repositories are not cloned or otherwise used, then there is no impact. A minor degradation in availability may also be possible, such as with a very large file named `CON`, though the user could interrupt the application.

Weakness: CWE-67 (Improper Handling of Windows Device Names)

## Which versions are affected by CVE-2024-35197?

17 open source packages ship an affected version, including gitoxide, gitoxide-core and gix.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `gitoxide` | crates.io | All versions | 0.36.0 |
| `gitoxide` | crates.io | All versions | 0.36.0 |
| `gitoxide-core` | crates.io | All versions | 0.38.0 |
| `gitoxide-core` | crates.io | All versions | 0.38.0 |
| `gix` | crates.io | All versions | 0.63.0 |
| `gix` | crates.io | All versions | 0.63.0 |
| `gix-index` | crates.io | All versions | 0.33.0 |
| `gix-index` | crates.io | All versions | 0.33.0 |
| `gix-index` | crates.io | From 0.0.0-0 | 0.33.0 |
| `gix-ref` | crates.io | All versions | 0.44.0 |
| `gix-ref` | crates.io | All versions | 0.44.0 |
| `gix-ref` | crates.io | From 0.0.0-0 | 0.44.0 |
| `gix-worktree` | crates.io | All versions | 0.34.0 |
| `gix-worktree` | crates.io | All versions | 0.34.0 |
| `gix-worktree` | crates.io | From 0.0.0-0 | 0.34.0 |
| `gix-worktree-state` | crates.io | All versions | 0.11.0 |
| `gix-worktree-state` | crates.io | All versions | 0.11.0 |

## How do I fix CVE-2024-35197?

Upgrade gitoxide to 0.36.0 or later.

## Is CVE-2024-35197 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-35197 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-35197 and fix it if it is affected.

What it is: CVE-2024-35197 is a medium-severity path traversal vulnerability in Byron gitoxide, published on 23 May 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-35197 exists.

Affected packages and fixed versions:
- gitoxide (crates.io): affected all versions; fixed in 0.36.0
- gitoxide (crates.io): affected all versions; fixed in 0.36.0
- gitoxide-core (crates.io): affected all versions; fixed in 0.38.0
- gitoxide-core (crates.io): affected all versions; fixed in 0.38.0
- gix (crates.io): affected all versions; fixed in 0.63.0
- gix (crates.io): affected all versions; fixed in 0.63.0
- gix-index (crates.io): affected all versions; fixed in 0.33.0
- gix-index (crates.io): affected all versions; fixed in 0.33.0
- gix-index (crates.io): affected from 0.0.0-0; fixed in 0.33.0
- gix-ref (crates.io): affected all versions; fixed in 0.44.0
- gix-ref (crates.io): affected all versions; fixed in 0.44.0
- gix-ref (crates.io): affected from 0.0.0-0; fixed in 0.44.0

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/CVE-2024-35197/ (Markdown: https://insights.sbomify.com/CVE-2024-35197/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-35197
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-35197
- OSV: https://osv.dev/vulnerability/CVE-2024-35197

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-35197/
Summaries are generated and may contain mistakes; the official description above is the record.
