GHSA-j39j-6gw9-jw6h: Git2 Git2 Has Potential Undefined Behavior Vulnerability
LOWGHSA-j39j-6gw9-jw6h is a LOW git2 has potential undefined behavior vulnerability (CWE-476: NULL Pointer Dereference) affecting Git2 libraries in the crates.io ecosystem. The issue involves git2 has potential undefined behavior when dereferencing buf struct. Remediation is available by upgrading affected packages to version 0.20.4.
GHSA-j39j-6gw9-jw6h at a Glance
How to Fix GHSA-j39j-6gw9-jw6h
To remediate this vulnerability, upgrade all affected Git2 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 git2 to 0.20.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for git2
How to Check if You Are Affected
To determine whether your application is affected by GHSA-j39j-6gw9-jw6h, inspect your project dependencies for Git2:
inspect dependencies for git2
Analyze the terminal output to locate any version of Git2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.20.4), 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-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. In Git2, 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
GHSA-j39j-6gw9-jw6h Affected Git2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
git2
|
crates.io |
< 0.20.4
|
0.20.4
|
References
Frequently Asked Questions
What is GHSA-j39j-6gw9-jw6h?
Which Git2 versions are affected?
What version fixes GHSA-j39j-6gw9-jw6h?
Is git2 affected?
What CWE is associated with GHSA-j39j-6gw9-jw6h?
How can I check crates.io dependencies for GHSA-j39j-6gw9-jw6h?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-j39j-6gw9-jw6h",
"modified" : "2026-02-04T20:36:04Z",
"published" : "2026-02-04T20:36:04Z",
"aliases" : [ ],
"summary" : "git2 has potential undefined behavior when dereferencing Buf struct ",
"details" : "If the Buf struct is dereferenced immediately after calling new() or default() on the Buf struct, a null pointer is passed to the unsafe function slice::from_raw_parts. According to the safety section documentation of the function, data must be non-null and aligned even for zero-length slices or slices of ZSTs. Thus, passing a null pointer will lead to undefined behavior.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "git2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.20.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rust-lang/git2-rs/issues/1211"
}, {
"type" : "WEB",
"url" : "https://github.com/rust-lang/git2-rs/pull/1213"
}, {
"type" : "WEB",
"url" : "https://github.com/rust-lang/git2-rs/commit/9e160f15bd056f82143109bb330573381e5de719"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-lang/git2-rs"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2026-0008.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-476" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2026-02-04T20:36:04Z",
"nvd_published_at" : null
}
}