GHSA-cx7h-h87r-jpgr
The kstring integration in gix-attributes is unsound
gix-attributes (in state::ValueRef) unsafely creates a &str from a &[u8] containing non-UTF8 data, with the justification that so long as nothing reads the &str and relies on it being UTF-8 in the &str, there is no UB:
// SAFETY: our API makes accessing that value as `str` impossible, so illformed UTF8 is never exposed as such.
The problem is that the non-UTF8 str is exposed to outside code: first to the kstring crate itself, which requires UTF-8 in its documentation and may have UB as a consequence of this, but also to serde, where it propagates to e.g. serde_json, serde_yaml, etc., where the same problems occur.
This is not sound, and it could cause further UB down the line in these places that can view the &str.
What each source reports
GitHub AdvisoriesNo score
The kstring integration in gix-attributes is unsound
gix-attributes (in state::ValueRef) unsafely creates a &str from a &[u8] containing non-UTF8 data, with the justification that so long as nothing reads the &str and relies on it being UTF-8 in the &str, there is no UB:
// SAFETY: our API makes accessing that value as `str` impossible, so illformed UTF8 is never exposed as such.
The problem is that the non-UTF8 str is exposed to outside code: first to the kstring crate itself, which requires UTF-8 in its documentation and may have UB as a consequence of this, but also to serde, where it propagates to e.g. serde_json, serde_yaml, etc., where the same problems occur.
This is not sound, and it could cause further UB down the line in these places that can view the &str.
- Record
GHSA-cx7h-h87r-jpgr- Weakness
- CWE-172
- Updated
- 2026-11-02
OSVNo score
The kstring integration in gix-attributes is unsound
gix-attributes (in state::ValueRef) unsafely creates a &str from a &[u8] containing non-UTF8 data, with the justification that so long as nothing reads the &str and relies on it being UTF-8 in the &str, there is no UB:
// SAFETY: our API makes accessing that value as `str` impossible, so illformed UTF8 is never exposed as such.
The problem is that the non-UTF8 str is exposed to outside code: first to the kstring crate itself, which requires UTF-8 in its documentation and may have UB as a consequence of this, but also to serde, where it propagates to e.g. serde_json, serde_yaml, etc., where the same problems occur.
This is not sound, and it could cause further UB down the line in these places that can view the &str.
- Record
GHSA-cx7h-h87r-jpgr- Weakness
- CWE-172
- Updated
- 2026-11-02
OSVRUSTSEC-2024-0359No score
The kstring integration in gix-attributes is unsound
gix-attributes (in state::ValueRef) unsafely creates a &str from a &[u8] containing non-UTF8 data, with the justification that so long as nothing reads the &str and relies on it being UTF-8 in the &str, there is no UB:
// SAFETY: our API makes accessing that value as `str` impossible, so illformed UTF8 is never exposed as such.
The problem is that the non-UTF8 str is exposed to outside code: first to the kstring crate itself, which requires UTF-8 in its documentation and may have UB as a consequence of this, but also to serde, where it propagates to e.g. serde_json, serde_yaml, etc., where the same problems occur.
This is not sound, and it could cause further UB down the line in these places that can view the &str.
Thanks to Devin Jeanpierre for discovering and reporting this issue.
- Record
RUSTSEC-2024-0359- Updated
- 2026-11-02
Affected packages
| Package | Affected | Fixed |
|---|---|---|
gix-attributescrates.io | before 0.22.3 | 0.22.3 |
gix-attributescrates.io | 0.0.0-0 up to 0.22.3 | 0.22.3 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | GitHub Advisories, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
GHSA-cx7h-h87r-jpgr is a vulnerability with no CVSS score yet in gix-attributes, published July 24, 2024. No source lists public exploit code. Fixed in gix-attributes 0.22.3.
References
github.com/Byron/gitoxide/issues/1460
github.com/rustsec/advisory-db/commit/884aaa1646132bc3a27ba058197d6ef039bec294
rustsec.org/advisories/RUSTSEC-2024-0359.html
github.com/GitoxideLabs/gitoxide/issues/1460
github.com/advisories/GHSA-cx7h-h87r-jpgr
github.com/Byron/gitoxide
crates.io/crates/gix-attributes