Loading...
Skip to main content

CVE-2025-31130 — Vulnerability in gix-worktree-state — CVE Details

MEDIUM

gitoxide does not detect SHA-1 collision attacks

Published April 4, 2025Updated September 10, 2026Source: osv

Summary

### Summary gitoxide uses SHA-1 hash implementations without any collision detection, leaving it vulnerable to hash collision attacks. ### Details 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. The SHA-1 function is considered cryptographically insecure. However, in the wake of the SHAttered attacks, this issue was mitigated in Git 2.13.0 in 2017 by using the [sha1collisiondetection](https://github.com/crmarcstevens/sha1collisiondetection) algorithm by default and producing an error when known SHA-1 collisions are detected. Git is in the process of migrating to using SHA-256 for object hashes, but this has not been rolled out widely yet and gitoxide does not support SHA-256 object hashes. ### PoC The following program demonstrates the problem, using the two [SHAttered PDFs](https://shattered.io/): ```rust use sha1_checked::{CollisionResult, Digest}; fn sha1_oid_of_file(filename: &str) -> gix::ObjectId { let mut hasher = gix::features::hash::hasher(gix::hash::Kind::Sha1); hasher.update(&std::fs::read(filename).unwrap()); gix::ObjectId::Sha1(hasher.digest()) } fn sha1dc_oid_of_file(filename: &str) -> Result<gix::ObjectId, String> { // Matches Git’s behaviour. let mut hasher = sha1_checked::Builder::default().safe_hash(false).build(); hasher.update(&std::fs::read(filename).unwrap()); match hasher.try_finalize() { CollisionResult::Ok(digest) => Ok(gix::ObjectId::Sha1(digest.into())), CollisionResult::Mitigated(_) => unreachable!(), CollisionResult::Collision(digest) => Err(format!( "Collision attack: {}", gix::ObjectId::Sha1(digest.into()).to_hex() )), } } fn main() { dbg!(sha1_oid_of_file("shattered-1.pdf")); dbg!(sha1_oid_of_file("shattered-2.pdf")); dbg!(sha1dc_oid_of_file("shattered-1.pdf")); dbg!(sha1dc_oid_of_file("shattered-2.pdf")); } ``` The output is as follows: ``` [src/main.rs:24:5] sha1_oid_of_file("shattered-1.pdf") = Sha1(38762cf7f55934b34d179ae6a4c80cadccbb7f0a) [src/main.rs:25:5] sha1_oid_of_file("shattered-2.pdf") = Sha1(38762cf7f55934b34d179ae6a4c80cadccbb7f0a) [src/main.rs:26:5] sha1dc_oid_of_file("shattered-1.pdf") = Err( "Collision attack: 38762cf7f55934b34d179ae6a4c80cadccbb7f0a", ) [src/main.rs:27:5] sha1dc_oid_of_file("shattered-2.pdf") = Err( "Collision attack: 38762cf7f55934b34d179ae6a4c80cadccbb7f0a", ) ``` The latter behaviour matches Git. Since the SHAttered PDFs are not in a valid format for Git objects, a direct proof‐of‐concept using higher‐level APIs cannot be immediately demonstrated without significant computational resources. ### Impact An attacker with the ability to mount a collision attack on SHA-1 like the [SHAttered](https://shattered.io/) or [SHA-1 is a Shambles](https://sha-mbles.github.io/) attacks could create two distinct Git objects with the same hash. This is becoming increasingly affordable for well‐resourced attackers, with the Shambles researchers in 2020 estimating $45k for a chosen‐prefix collision or $11k for a classical collision, and projecting less than $10k for a chosen‐prefix collision by 2025. The result could be used to disguise malicious repository contents, or potentially exploit assumptions in the logic of programs using gitoxide to cause further vulnerabilities. This vulnerability affects any user of gitoxide, including `gix-*` library crates, that reads or writes Git objects.

Advisory Timeline

  • First published April 4, 2025 (556 days ago).
  • Last revised September 10, 2026 — 523 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Cargo
Update gix-worktree-state to 0.18.0 or later
cargo update -p gix-worktree-state --precise 0.18.0
Cargo
Update gix-revwalk to 0.19.0 or later
cargo update -p gix-revwalk --precise 0.19.0
Cargo
Update gix-config to 0.44.0 or later
cargo update -p gix-config --precise 0.44.0
Cargo
Update gix-commitgraph to 0.27.0 or later
cargo update -p gix-commitgraph --precise 0.27.0
Cargo
Update gix-filter to 0.18.0 or later
cargo update -p gix-filter --precise 0.18.0
Cargo
Update gix-protocol to 0.49.0 or later
cargo update -p gix-protocol --precise 0.49.0
Cargo
Update gix-object to 0.48.0 or later
cargo update -p gix-object --precise 0.48.0
Cargo
Update gitoxide-core to 0.46.0 or later
cargo update -p gitoxide-core --precise 0.46.0
Cargo
Update gix-diff to 0.51.0 or later
cargo update -p gix-diff --precise 0.51.0
Cargo
Update gix-discover to 0.39.0 or later
cargo update -p gix-discover --precise 0.39.0
Cargo
Update gix-negotiate to 0.19.0 or later
cargo update -p gix-negotiate --precise 0.19.0
Cargo
Update gix-ref to 0.51.0 or later
cargo update -p gix-ref --precise 0.51.0
Cargo
Update gix-odb to 0.68.0 or later
cargo update -p gix-odb --precise 0.68.0
Cargo
Update gix-traverse to 0.45.0 or later
cargo update -p gix-traverse --precise 0.45.0
Cargo
Update gix-pack to 0.58.0 or later
cargo update -p gix-pack --precise 0.58.0
Cargo
Update gix-index to 0.39.0 or later
cargo update -p gix-index --precise 0.39.0
Cargo
Update gitoxide to 0.42.0 or later
cargo update -p gitoxide --precise 0.42.0
Cargo
Update gix-status to 0.18.0 or later
cargo update -p gix-status --precise 0.18.0
Cargo
Update gix-dir to 0.13.0 or later
cargo update -p gix-dir --precise 0.13.0
Cargo
Update gix-revision to 0.33.0 or later
cargo update -p gix-revision --precise 0.33.0
Cargo
Update gix to 0.71.0 or later
cargo update -p gix --precise 0.71.0
Cargo
Update gix-fsck to 0.10.0 or later
cargo update -p gix-fsck --precise 0.10.0
Cargo
Update gix-worktree to 0.40.0 or later
cargo update -p gix-worktree --precise 0.40.0
Cargo
Update gix-merge to 0.4.0 or later
cargo update -p gix-merge --precise 0.4.0
Cargo
Update gix-features to 0.41.0 or later
cargo update -p gix-features --precise 0.41.0
Cargo
Update gix-archive to 0.20.0 or later
cargo update -p gix-archive --precise 0.20.0
Cargo
Update gix-blame to 0.1.0 or later
cargo update -p gix-blame --precise 0.1.0

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (27)

Affects 1 ecosystem: crates.io (27).

PackageEcosystemAffectedFixed In
gix-worktree-state
crates.io
All versions0.18.0
gix-revwalk
crates.io
All versions0.19.0
gix-config
crates.io
All versions0.44.0
gix-commitgraph
crates.io
All versions0.27.0
gix-filter
crates.io
All versions0.18.0
gix-protocol
crates.io
All versions0.49.0
gix-object
crates.io
All versions0.48.0
gitoxide-core
crates.io
All versions0.46.0
gix-diff
crates.io
All versions0.51.0
gix-discover
crates.io
All versions0.39.0
gix-negotiate
crates.io
All versions0.19.0
gix-ref
crates.io
All versions0.51.0
gix-odb
crates.io
All versions0.68.0
gix-traverse
crates.io
All versions0.45.0
gix-pack
crates.io
All versions0.58.0
gix-index
crates.io
All versions0.39.0
gitoxide
crates.io
All versions0.42.0
gix-status
crates.io
All versions0.18.0
gix-dir
crates.io
All versions0.13.0
gix-revision
crates.io
All versions0.33.0
gix
crates.io
All versions0.71.0
gix-fsck
crates.io
All versions0.10.0
gix-worktree
crates.io
All versions0.40.0
gix-merge
crates.io
All versions0.4.0
gix-features
crates.io
All versions0.41.0
gix-archive
crates.io
All versions0.20.0
gix-blame
crates.io
All versions0.1.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
None
Integrity
High
Availability
None

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N

Frequently Asked Questions

What is CVE-2025-31130?
gitoxide does not detect SHA-1 collision attacks This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.8/10).
How do I check if my project is affected by CVE-2025-31130?
CVE-2025-31130 affects gix-worktree-state, gix-revwalk and gix-config (and 24 more). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-31130 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.8

Exploitation requires specific conditions or has limited impact. Remediate within weeks.

Also Known As

GHSA-2frx-2596-x5r6
RUSTSEC-2025-0021

Related CVEs

  • CVE-2024-35186
    HIGH

    gix traversal outside working tree enables arbitrary code execution

  • CVE-2026-102821
    MEDIUM

    Russh: Unbounded memory exhaustion via CHANNEL_OPEN flood during a client-stalled rekey

  • CVE-2024-35197
    MEDIUM

    gix refs and paths with reserved Windows device names access the devices

  • CVE-2026-102820
    MEDIUM

    pageant: Out-of-bounds read / oversized allocation in `pageant` MemoryMap::read via a malicious Pageant agent (Windows)

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies