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 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:
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 or SHA-1 is a Shambles 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.
CVE-2025-31130 has a CVSS score of 6.8 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (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); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
gix-features to 0.41.0 or later; gix-commitgraph to 0.27.0 or later; gix-index to 0.39.0 or later; gix-object to 0.48.0 or later; gix-odb to 0.68.0 or later; gix-pack to 0.58.0 or later; gitoxide to 0.42.0 or later; gitoxide-core to 0.46.0 or later; gix to 0.71.0 or later; gix-archive to 0.20.0 or later; gix-blame to 0.1.0 or later; gix-config to 0.44.0 or later; gix-diff to 0.51.0 or later; gix-dir to 0.13.0 or later; gix-discover to 0.39.0 or later; gix-filter to 0.18.0 or later; gix-fsck to 0.10.0 or later; gix-merge to 0.4.0 or later; gix-negotiate to 0.19.0 or later; gix-protocol to 0.49.0 or later; gix-ref to 0.51.0 or later; gix-revision to 0.33.0 or later; gix-revwalk to 0.19.0 or later; gix-status to 0.18.0 or later; gix-traverse to 0.45.0 or later; gix-worktree to 0.40.0 or later; gix-worktree-state to 0.18.0 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2025-31130? CVE-2025-31130 is a medium-severity security vulnerability in gix-features (rust), affecting versions < 0.41.0. It is fixed in 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.
- How severe is CVE-2025-31130? CVE-2025-31130 has a CVSS score of 6.8 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2025-31130?
gix-features(rust) (versions < 0.41.0)gix-commitgraph(rust) (versions < 0.27.0)gix-index(rust) (versions < 0.39.0)gix-object(rust) (versions < 0.48.0)gix-odb(rust) (versions < 0.68.0)gix-pack(rust) (versions < 0.58.0)gitoxide(rust) (versions < 0.42.0)gitoxide-core(rust) (versions < 0.46.0)gix(rust) (versions < 0.71.0)gix-archive(rust) (versions < 0.20.0)gix-blame(rust) (versions < 0.1.0)gix-config(rust) (versions < 0.44.0)gix-diff(rust) (versions < 0.51.0)gix-dir(rust) (versions < 0.13.0)gix-discover(rust) (versions < 0.39.0)gix-filter(rust) (versions < 0.18.0)gix-fsck(rust) (versions < 0.10.0)gix-merge(rust) (versions < 0.4.0)gix-negotiate(rust) (versions < 0.19.0)gix-protocol(rust) (versions < 0.49.0)gix-ref(rust) (versions < 0.51.0)gix-revision(rust) (versions < 0.33.0)gix-revwalk(rust) (versions < 0.19.0)gix-status(rust) (versions < 0.18.0)gix-traverse(rust) (versions < 0.45.0)gix-worktree(rust) (versions < 0.40.0)gix-worktree-state(rust) (versions < 0.18.0)
- Is there a fix for CVE-2025-31130? Yes. CVE-2025-31130 is fixed in 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. Upgrade to this version or later.
- Is CVE-2025-31130 exploitable, and should I be worried? Whether CVE-2025-31130 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2025-31130 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2025-31130?
- Upgrade
gix-featuresto 0.41.0 or later - Upgrade
gix-commitgraphto 0.27.0 or later - Upgrade
gix-indexto 0.39.0 or later - Upgrade
gix-objectto 0.48.0 or later - Upgrade
gix-odbto 0.68.0 or later - Upgrade
gix-packto 0.58.0 or later - Upgrade
gitoxideto 0.42.0 or later - Upgrade
gitoxide-coreto 0.46.0 or later - Upgrade
gixto 0.71.0 or later - Upgrade
gix-archiveto 0.20.0 or later - Upgrade
gix-blameto 0.1.0 or later - Upgrade
gix-configto 0.44.0 or later - Upgrade
gix-diffto 0.51.0 or later - Upgrade
gix-dirto 0.13.0 or later - Upgrade
gix-discoverto 0.39.0 or later - Upgrade
gix-filterto 0.18.0 or later - Upgrade
gix-fsckto 0.10.0 or later - Upgrade
gix-mergeto 0.4.0 or later - Upgrade
gix-negotiateto 0.19.0 or later - Upgrade
gix-protocolto 0.49.0 or later - Upgrade
gix-refto 0.51.0 or later - Upgrade
gix-revisionto 0.33.0 or later - Upgrade
gix-revwalkto 0.19.0 or later - Upgrade
gix-statusto 0.18.0 or later - Upgrade
gix-traverseto 0.45.0 or later - Upgrade
gix-worktreeto 0.40.0 or later - Upgrade
gix-worktree-stateto 0.18.0 or later
- Upgrade