# CVE-2025-31130: gitoxide does not detect SHA-1 collision attacks


- **Severity:** Medium 6.8 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 4 Apr 2025
- **Updated:** 23 Jan 2026
- **Also known as:** DEBIAN-CVE-2025-31130, GHSA-2frx-2596-x5r6, MINI-wj8m-7cjc-fx46, RUSTSEC-2025-0021, UBUNTU-CVE-2025-31130

## What is CVE-2025-31130?

CVE-2025-31130 is a medium-severity vulnerability in GitoxideLabs gitoxide, published on 4 Apr 2025. 

### Official description

gitoxide is an implementation of git written in Rust. Before 0.42.0, gitoxide uses SHA-1 hash implementations without any collision detection, leaving it vulnerable to hash collision attacks. gitoxide uses the sha1_smol or sha1 crate, both of which implement standard SHA-1 without any mitigations for collision attacks. This means that two distinct Git objects with colliding SHA-1 hashes would break the Git object model and integrity checks when used with gitoxide. This vulnerability is fixed in 0.42.0.

Weakness: CWE-328 (Use of Weak Hash)

## Which versions are affected by CVE-2025-31130?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `gitoxide` | crates.io | All versions | 0.42.0 |
| `gitoxide` | crates.io | All versions | 0.42.0 |
| `gitoxide-core` | crates.io | All versions | 0.46.0 |
| `gitoxide-core` | crates.io | All versions | 0.46.0 |
| `gix` | crates.io | All versions | 0.71.0 |
| `gix` | crates.io | All versions | 0.71.0 |
| `gix-archive` | crates.io | All versions | 0.20.0 |
| `gix-archive` | crates.io | All versions | 0.20.0 |
| `gix-blame` | crates.io | All versions | 0.1.0 |
| `gix-blame` | crates.io | All versions | 0.1.0 |
| `gix-commitgraph` | crates.io | All versions | 0.27.0 |
| `gix-commitgraph` | crates.io | All versions | 0.27.0 |
| `gix-config` | crates.io | All versions | 0.44.0 |
| `gix-config` | crates.io | All versions | 0.44.0 |
| `gix-diff` | crates.io | All versions | 0.51.0 |
| `gix-diff` | crates.io | All versions | 0.51.0 |
| `gix-dir` | crates.io | All versions | 0.13.0 |
| `gix-dir` | crates.io | All versions | 0.13.0 |
| `gix-discover` | crates.io | All versions | 0.39.0 |
| `gix-discover` | crates.io | All versions | 0.39.0 |
| `gix-features` | crates.io | All versions | 0.41.0 |
| `gix-features` | crates.io | All versions | 0.41.0 |
| `gix-features` | crates.io | From 0.0.0-0 | 0.41.0 |
| `gix-filter` | crates.io | All versions | 0.18.0 |
| `gix-filter` | crates.io | All versions | 0.18.0 |
| `gix-fsck` | crates.io | All versions | 0.10.0 |
| `gix-fsck` | crates.io | All versions | 0.10.0 |
| `gix-index` | crates.io | All versions | 0.39.0 |
| `gix-index` | crates.io | All versions | 0.39.0 |
| `gix-merge` | crates.io | All versions | 0.4.0 |
| `gix-merge` | crates.io | All versions | 0.4.0 |
| `gix-negotiate` | crates.io | All versions | 0.19.0 |
| `gix-negotiate` | crates.io | All versions | 0.19.0 |
| `gix-object` | crates.io | All versions | 0.48.0 |
| `gix-object` | crates.io | All versions | 0.48.0 |
| `gix-odb` | crates.io | All versions | 0.68.0 |
| `gix-odb` | crates.io | All versions | 0.68.0 |
| `gix-pack` | crates.io | All versions | 0.58.0 |
| `gix-pack` | crates.io | All versions | 0.58.0 |
| `gix-protocol` | crates.io | All versions | 0.49.0 |

## How do I fix CVE-2025-31130?

Upgrade gitoxide to 0.42.0 or later.

## Is CVE-2025-31130 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-31130 and fix it if it is affected.

What it is: CVE-2025-31130 is a medium-severity vulnerability in GitoxideLabs gitoxide, published on 4 Apr 2025. 
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-31130 exists.

Affected packages and fixed versions:
- gitoxide (crates.io): affected all versions; fixed in 0.42.0
- gitoxide (crates.io): affected all versions; fixed in 0.42.0
- gitoxide-core (crates.io): affected all versions; fixed in 0.46.0
- gitoxide-core (crates.io): affected all versions; fixed in 0.46.0
- gix (crates.io): affected all versions; fixed in 0.71.0
- gix (crates.io): affected all versions; fixed in 0.71.0
- gix-archive (crates.io): affected all versions; fixed in 0.20.0
- gix-archive (crates.io): affected all versions; fixed in 0.20.0
- gix-blame (crates.io): affected all versions; fixed in 0.1.0
- gix-blame (crates.io): affected all versions; fixed in 0.1.0
- gix-commitgraph (crates.io): affected all versions; fixed in 0.27.0
- gix-commitgraph (crates.io): affected all versions; fixed in 0.27.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-2025-31130/ (Markdown: https://insights.sbomify.com/CVE-2025-31130/index.md)
```

## Sources

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

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