CVE-2025-31130: Gix features Gitoxide Does Not Detect SHA-1 Vulnerability
MODERATECVE-2025-31130 is a MODERATE (CVSS 6.8) gitoxide does not detect sha-1 vulnerability (CWE-328: Use of Weak Hash) affecting Gix features libraries in the crates.io ecosystem. The issue involves gitoxide does not detect sha-1 collision attacks. Remediation is available by upgrading affected packages to version 0.41.0, 0.27.0, 0.39.0, 0.48.0, 0.68.0, 0.58.0, 0.42.0, 0.46.0, 0.71.0, 0.20.0, 0.1.0, 0.44.0, 0.51.0, 0.13.0, 0.18.0, 0.10.0, 0.4.0, 0.19.0, 0.49.0, 0.33.0, 0.45.0, 0.40.0.
CVE-2025-31130 at a Glance
Security Impact
CVSS: 6.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N).
How to Fix CVE-2025-31130
To remediate this vulnerability, upgrade all affected Gix features dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade gix-features to 0.41.0
Upgrade gix-commitgraph to 0.27.0
Upgrade gix-index to 0.39.0
Upgrade gix-object to 0.48.0
Upgrade gix-odb to 0.68.0
Upgrade gix-pack to 0.58.0
Upgrade gitoxide to 0.42.0
Upgrade gitoxide-core to 0.46.0
Upgrade gix to 0.71.0
Upgrade gix-archive to 0.20.0
Upgrade gix-blame to 0.1.0
Upgrade gix-config to 0.44.0
Upgrade gix-diff to 0.51.0
Upgrade gix-dir to 0.13.0
Upgrade gix-discover to 0.39.0
Upgrade gix-filter to 0.18.0
Upgrade gix-fsck to 0.10.0
Upgrade gix-merge to 0.4.0
Upgrade gix-negotiate to 0.19.0
Upgrade gix-protocol to 0.49.0
Upgrade gix-ref to 0.51.0
Upgrade gix-revision to 0.33.0
Upgrade gix-revwalk to 0.19.0
Upgrade gix-status to 0.18.0
Upgrade gix-traverse to 0.45.0
Upgrade gix-worktree to 0.40.0
Upgrade gix-worktree-state to 0.18.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for gix-features
How to Check if You Are Affected
To determine whether your application is affected by CVE-2025-31130, inspect your project dependencies for Gix features:
inspect dependencies for gix-features
Analyze the terminal output to locate any version of Gix features in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.41.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-328: Use of Weak Hash, where the product uses an algorithm that produces a digest (output value) that does not meet security expectations for a hash function that allows an adversary to reasonably determine the original input (preimage attack), find another input that can produce the same hash (2nd preimage attack), or find multiple inputs that evaluate to the same hash (birthday attack). In Gix features, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-31130 Affected Gix features Versions
27 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
gix-features
|
crates.io |
< 0.41.0
|
0.41.0
|
|
gix-commitgraph
|
crates.io |
< 0.27.0
|
0.27.0
|
|
gix-index
|
crates.io |
< 0.39.0
|
0.39.0
|
|
gix-object
|
crates.io |
< 0.48.0
|
0.48.0
|
|
gix-odb
|
crates.io |
< 0.68.0
|
0.68.0
|
|
gix-pack
|
crates.io |
< 0.58.0
|
0.58.0
|
|
gitoxide
|
crates.io |
< 0.42.0
|
0.42.0
|
|
gitoxide-core
|
crates.io |
< 0.46.0
|
0.46.0
|
|
gix
|
crates.io |
< 0.71.0
|
0.71.0
|
|
gix-archive
|
crates.io |
< 0.20.0
|
0.20.0
|
|
gix-blame
|
crates.io |
< 0.1.0
|
0.1.0
|
|
gix-config
|
crates.io |
< 0.44.0
|
0.44.0
|
|
gix-diff
|
crates.io |
< 0.51.0
|
0.51.0
|
|
gix-dir
|
crates.io |
< 0.13.0
|
0.13.0
|
|
gix-discover
|
crates.io |
< 0.39.0
|
0.39.0
|
|
gix-filter
|
crates.io |
< 0.18.0
|
0.18.0
|
|
gix-fsck
|
crates.io |
< 0.10.0
|
0.10.0
|
|
gix-merge
|
crates.io |
< 0.4.0
|
0.4.0
|
|
gix-negotiate
|
crates.io |
< 0.19.0
|
0.19.0
|
|
gix-protocol
|
crates.io |
< 0.49.0
|
0.49.0
|
|
gix-ref
|
crates.io |
< 0.51.0
|
0.51.0
|
|
gix-revision
|
crates.io |
< 0.33.0
|
0.33.0
|
|
gix-revwalk
|
crates.io |
< 0.19.0
|
0.19.0
|
|
gix-status
|
crates.io |
< 0.18.0
|
0.18.0
|
|
gix-traverse
|
crates.io |
< 0.45.0
|
0.45.0
|
|
gix-worktree
|
crates.io |
< 0.40.0
|
0.40.0
|
|
gix-worktree-state
|
crates.io |
< 0.18.0
|
0.18.0
|
References
Frequently Asked Questions
What is CVE-2025-31130?
Which Gix features versions are affected?
What version fixes CVE-2025-31130?
Is gix-features affected?
Is gix-commitgraph affected?
What is the CVSS score of CVE-2025-31130?
What CWE is associated with CVE-2025-31130?
How can I check crates.io dependencies for CVE-2025-31130?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2frx-2596-x5r6",
"modified" : "2026-01-23T17:09:14Z",
"published" : "2025-04-04T16:06:08Z",
"aliases" : [ "CVE-2025-31130" ],
"summary" : "gitoxide does not detect SHA-1 collision attacks",
"details" : "### Summary\ngitoxide uses SHA-1 hash implementations without any collision detection, leaving it vulnerable to hash collision attacks.\n\n### Details\ngitoxide 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.\n\nThe 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.\n\n### PoC\nThe following program demonstrates the problem, using the two [SHAttered PDFs](https://shattered.io/):\n\n```rust\nuse sha1_checked::{CollisionResult, Digest};\n\nfn sha1_oid_of_file(filename: &str) -> gix::ObjectId {\n let mut hasher = gix::features::hash::hasher(gix::hash::Kind::Sha1);\n hasher.update(&std::fs::read(filename).unwrap());\n gix::ObjectId::Sha1(hasher.digest())\n}\n\nfn sha1dc_oid_of_file(filename: &str) -> Result<gix::ObjectId, String> {\n // Matches Git’s behaviour.\n let mut hasher = sha1_checked::Builder::default().safe_hash(false).build();\n hasher.update(&std::fs::read(filename).unwrap());\n match hasher.try_finalize() {\n CollisionResult::Ok(digest) => Ok(gix::ObjectId::Sha1(digest.into())),\n CollisionResult::Mitigated(_) => unreachable!(),\n CollisionResult::Collision(digest) => Err(format!(\n \"Collision attack: {}\",\n gix::ObjectId::Sha1(digest.into()).to_hex()\n )),\n }\n}\n\nfn main() {\n dbg!(sha1_oid_of_file(\"shattered-1.pdf\"));\n dbg!(sha1_oid_of_file(\"shattered-2.pdf\"));\n dbg!(sha1dc_oid_of_file(\"shattered-1.pdf\"));\n dbg!(sha1dc_oid_of_file(\"shattered-2.pdf\"));\n}\n```\n\nThe output is as follows:\n\n```\n[src/main.rs:24:5] sha1_oid_of_file(\"shattered-1.pdf\") = Sha1(38762cf7f55934b34d179ae6a4c80cadccbb7f0a)\n[src/main.rs:25:5] sha1_oid_of_file(\"shattered-2.pdf\") = Sha1(38762cf7f55934b34d179ae6a4c80cadccbb7f0a)\n[src/main.rs:26:5] sha1dc_oid_of_file(\"shattered-1.pdf\") = Err(\n \"Collision attack: 38762cf7f55934b34d179ae6a4c80cadccbb7f0a\",\n)\n[src/main.rs:27:5] sha1dc_oid_of_file(\"shattered-2.pdf\") = Err(\n \"Collision attack: 38762cf7f55934b34d179ae6a4c80cadccbb7f0a\",\n)\n```\n\nThe latter behaviour matches Git.\n\nSince 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.\n\n### Impact\nAn 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.\n\nThis vulnerability affects any user of gitoxide, including `gix-*` library crates, that reads or writes Git objects.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-features"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.41.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-commitgraph"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.27.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-index"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.39.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-object"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.48.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-odb"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.68.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-pack"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.58.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gitoxide"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.42.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gitoxide-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.46.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.71.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-archive"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.20.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-blame"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.1.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-config"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.44.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-diff"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.51.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-dir"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.13.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-discover"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.39.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-filter"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.18.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-fsck"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.10.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-merge"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.4.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-negotiate"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.19.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-protocol"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.49.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-ref"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.51.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-revision"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.33.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-revwalk"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.19.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-status"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.18.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-traverse"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.45.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-worktree"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.40.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "gix-worktree-state"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.18.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/GitoxideLabs/gitoxide/security/advisories/GHSA-2frx-2596-x5r6"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-31130"
}, {
"type" : "WEB",
"url" : "https://github.com/GitoxideLabs/gitoxide/commit/f253f02a6658b3b7612a50d56c71f5ae4da4ca21"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/GitoxideLabs/gitoxide"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2025-0021.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-328" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-04-04T16:06:08Z",
"nvd_published_at" : "2025-04-04T15:15:48Z"
}
}