SHA-1 collision attacks are not detected
### 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 { // Matches Git’s behaviour. let mut hasher = sha1_checked::Builder::default().safe_hash(false).build(); hasher.update(&std::fs::read(filename
- Products
- gix-features
- Affected versions
- Not specified
- Fixed versions
- 0.41.0
- CVEs
- CVE-2025-31130
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 30 Oct 2026, 08:43 UTC · Revision 1
Source evidence
### 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 { // Matches Git’s behaviour. let mut hasher = sha1_checked::Builder::default().safe_hash(false).build(); hasher.update(&std::fs::read(filename
osv:RUSTSEC-2025-0021
gix-features
Fixed versions: 0.41.0
Complete source record
{
"id": "ef20bc9b02e8bd811de85b72d12864406582ed5b0d33b0f37a4e84307d24ffcd",
"url": "https://osv.dev/vulnerability/RUSTSEC-2025-0021",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "SHA-1 collision attacks are not detected",
"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 { // Matches Git’s behaviour. let mut hasher = sha1_checked::Builder::default().safe_hash(false).build(); hasher.update(&std::fs::read(filename",
"evidence": "osv:RUSTSEC-2025-0021",
"products": [
{
"name": {
"value": "gix-features",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "0.41.0",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "medium",
"structured": {
"id": "RUSTSEC-2025-0021",
"aliases": [
"CVE-2025-31130",
"GHSA-2frx-2596-x5r6",
"RUSTSEC-2025-0021"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N"
}
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "0.41.0"
}
]
}
],
"package": {
"name": "gix-features",
"purl": "pkg:cargo/gix-features",
"ecosystem": "crates.io"
},
"database_specific": {
"cvss": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N",
"source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2025-0021.json",
"categories": [
"crypto-failure"
],
"informational": null
},
"ecosystem_specific": {
"affects": {
"os": [],
"arch": [],
"functions": [
"gix_features::hash::Hasher::digest",
"gix_features::hash::Hasher::update",
"gix_features::hash::Write::flush",
"gix_features::hash::Write::new",
"gix_features::hash::Write::write",
"gix_features::hash::bytes",
"gix_features::hash::bytes_of_file",
"gix_features::hash::bytes_with_hasher",
"gix_features::hash::hasher"
]
},
"affected_functions": null
}
}
],
"modified": "2026-10-12T18:00:10.946699881Z",
"provider": "osv",
"references": [
"https://crates.io/crates/gix-features",
"https://rustsec.org/advisories/RUSTSEC-2025-0021.html",
"https://github.com/GitoxideLabs/gitoxide/commit/f253f02a6658b3b7612a50d56c71f5ae4da4ca21",
"https://github.com/advisories/GHSA-2frx-2596-x5r6",
"https://nvd.nist.gov/vuln/detail/CVE-2025-31130"
],
"provider_metadata": {
"license": "CC0-1.0"
}
},
"related_cves": [
{
"value": "CVE-2025-31130",
"evidence": "/aliases"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 306409,
"published_at": "2025-04-03T12:00:00+00:00"
}