# CVE-2024-45305: gix-path uses local config across repos when it is the highest scope

> A flaw in gix-path may leak sensitive credentials or treat untrusted repositories as trusted due to incorrect configuration scope handling.

- **Severity:** Low 2.5 (`CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 2 Sep 2024
- **Updated:** 3 Sep 2024
- **Also known as:** CVE-2024-8371, DEBIAN-CVE-2024-45305, GHSA-v26r-4c9c-h3j6, RUSTSEC-2024-0367, UBUNTU-CVE-2024-45305

## What is CVE-2024-45305?

CVE-2024-45305 is a low-severity vulnerability in Byron gitoxide, published on 2 Sep 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

gix-path is a crate of the gitoxide project dealing with git paths and their conversions. `gix-path` executes `git` to find the path of a configuration file that belongs to the `git` installation itself, but mistakenly treats the local repository's configuration as system-wide if no higher scoped configuration is found. In rare cases, this causes a less trusted repository to be treated as more trusted, or leaks sensitive information from one repository to another, such as sending credentials to another repository's remote. In `gix_path::env`, the underlying implementation of the `installation_config` and `installation_config_prefix` functions calls `git config -l --show-origin` and parses the first line of the output to extract the path to the configuration file holding the configuration variable of highest scope. It is believed to be very difficult to exploit this vulnerability deliberately, due to the need either to anticipate a situation in which higher-scoped configuration variables would be absent, or to arrange for this to happen. Although any operating system may be affected, users running Apple Git on macOS are much less likely to be affected. This issue has been addressed in release version 0.10.10. All users are advised to upgrade.

Weakness: CWE-706 (Use of Incorrectly-Resolved Name or Reference)

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

3 open source packages ship an affected version, including gix-path.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `gix-path` | crates.io | All versions | 0.10.10 |
| `gix-path` | crates.io | All versions | 0.10.10 |
| `gix-path` | crates.io | From 0.0.0-0 | 0.10.10 |

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

Upgrade gix-path to 0.10.10 or later.

## Is CVE-2024-45305 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2024-45305 is a low-severity vulnerability in Byron gitoxide, published on 2 Sep 2024. It can only be exploited from the same machine or local network, 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-45305 exists.

Affected packages and fixed versions:
- gix-path (crates.io): affected all versions; fixed in 0.10.10
- gix-path (crates.io): affected all versions; fixed in 0.10.10
- gix-path (crates.io): affected from 0.0.0-0; fixed in 0.10.10

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

## Sources

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

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