GHSA-cx7h-h87r-jpgr
LOWThe 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.
- Published
- 24 Jul 2024
- Last modified
- 10 Sep 2026
- Weakness
- CWE-172
- Also known as
- RUSTSEC-2024-0359
- Sources
- OSVJSONOSV RUSTSEC-2024-0359JSON
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| OSV | crates.io | gix-attributes | < 0.22.3 | 0.22.3 |
| OSV | crates.io | gix-attributes | >= 0.0.0-0, < 0.22.3 | 0.22.3 |
References
- https://github.com/Byron/gitoxide/issues/1460 · WEB
- https://github.com/GitoxideLabs/gitoxide/issues/1460 · WEB, REPORT
- https://github.com/rustsec/advisory-db/commit/884aaa1646132bc3a27ba058197d6ef039bec294 · WEB
- https://github.com/Byron/gitoxide · PACKAGE
- https://rustsec.org/advisories/RUSTSEC-2024-0359.html · WEB, ADVISORY
- https://crates.io/crates/gix-attributes · PACKAGE
History
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 24 Jul 2024)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 25 Jul 2024)