GHSA-wrw7-89jp-8q8g: Glib :VariantStrIter` Vulnerability
MODERATEGHSA-wrw7-89jp-8q8g is a MODERATE :variantstriter` vulnerability (General Security Weakness) affecting Glib libraries in the crates.io ecosystem. The issue involves :variantstriter`. Remediation is available by upgrading affected packages to version 0.20.0.
GHSA-wrw7-89jp-8q8g at a Glance
How to Fix GHSA-wrw7-89jp-8q8g
To remediate this vulnerability, upgrade all affected Glib 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 glib to 0.20.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for glib
How to Check if You Are Affected
To determine whether your application is affected by GHSA-wrw7-89jp-8q8g, inspect your project dependencies for Glib:
inspect dependencies for glib
Analyze the terminal output to locate any version of Glib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.20.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 General Security Weakness. In Glib, 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-wrw7-89jp-8q8g Affected Glib Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
glib
|
crates.io |
≥ 0.15.0
< 0.20.0
|
0.20.0
|
References
Frequently Asked Questions
What is GHSA-wrw7-89jp-8q8g?
Which Glib versions are affected?
What version fixes GHSA-wrw7-89jp-8q8g?
Is glib affected?
What CWE is associated with GHSA-wrw7-89jp-8q8g?
How can I check crates.io dependencies for GHSA-wrw7-89jp-8q8g?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wrw7-89jp-8q8g",
"modified" : "2024-12-23T20:19:24Z",
"published" : "2024-12-23T20:19:24Z",
"aliases" : [ ],
"summary" : "Unsoundness in `Iterator` and `DoubleEndedIterator` impls for `glib::VariantStrIter`",
"details" : "The `VariantStrIter::impl_get` function (called internally by implementations of the `Iterator` and `DoubleEndedIterator` traits for this type) was unsound, resulting in undefined behaviour.\n\nAn immutable reference `&p` to a `*mut libc::c_char` pointer initialized to `NULL` was passed as an argument to a C function that that mutates the pointer behind `&p` in-place (i.e. as an out-argument), which was unsound. After changes in recent versions of the Rust compiler, these unsound writes through `&p` now seem to be completely disregarded when building the `glib` crate with optimizations.\n\nThis subsequently caused all calls of `VariantStrIter::impl_get` to violate the safety requirements of the `std::ffi::CStr::from_ptr` function - which requires its argument to be a valid pointer to a C-style string - resulting in crashes due to `NULL` pointer dereferences.\n\nThis was fixed by passing the out-argument pointer explitly as `&mut p` instead of `&p`.\n\nThis issue has been present since this code was initially added in `glib` v0.15.0. The mismatch in mutability was likely missed (and not raised as an error by the compiler) because the C function wrapped by `VariantStrIter::impl_get` is variadic (`glib_sys::g_variant_get_child`), and the pointer in question is one of the variadic arguments.\n\n",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "glib"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.15.0"
}, {
"fixed" : "0.20.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gtk-rs/gtk-rs-core/pull/1343"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gtk-rs/gtk-rs-core"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2024-0429.html"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-23T20:19:24Z",
"nvd_published_at" : null
}
}