{"answers":{"affected":"3 open source packages ship an affected version, including gix-attributes.","exploited":"There is no known exploitation of GHSA-cx7h-h87r-jpgr in the wild and no public exploit code.","fix":"Upgrade gix-attributes to 0.22.3 or later.","what":"GHSA-cx7h-h87r-jpgr is a memory corruption vulnerability in gix-attributes, published on 24 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-cx7h-h87r-jpgr and fix it if it is affected.\n\nWhat it is: GHSA-cx7h-h87r-jpgr is a memory corruption vulnerability in gix-attributes, published on 24 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-cx7h-h87r-jpgr in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- gix-attributes (crates.io): affected all versions; fixed in 0.22.3\n- gix-attributes (crates.io): affected all versions; fixed in 0.22.3\n- gix-attributes (crates.io): affected from 0.0.0-0; fixed in 0.22.3\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-cx7h-h87r-jpgr/ (Markdown: https://insights.sbomify.com/GHSA-cx7h-h87r-jpgr/index.md)","id":"GHSA-cx7h-h87r-jpgr","markdown":"https://insights.sbomify.com/GHSA-cx7h-h87r-jpgr/index.md","name":"GHSA-cx7h-h87r-jpgr","record":{"aliases":["RUSTSEC-2024-0359"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution","denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"Rust git library","requires_auth":"none","summary":"Unsound UTF-8 handling in gix-attributes exposes invalid strings to dependent crates, potentially causing memory corruption or crashes.","user_interaction":"not_required","vuln_class":"memory_corruption"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"`gix-attributes` (in [`state::ValueRef`](https://github.com/Byron/gitoxide/blob/gix-attributes-v0.22.2/gix-attributes/src/state.rs#L19-L27)) unsafely creates a `\u0026str` from a `\u0026[u8]` containing non-UTF8 data, with the justification that so long as nothing reads the `\u0026str` and relies on it being UTF-8 in the `\u0026str`, there is no UB:\n\n```rust\n// SAFETY: our API makes accessing that value as `str` impossible, so illformed UTF8 is never exposed as such.\n```\n\nThe 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.\n\nThis is not sound, and it could cause further UB down the line in these places that can view the `\u0026str`.\n\n*Thanks to [Devin Jeanpierre](https://github.com/ssbr) for discovering and reporting this issue.*","ecosystems":["crates.io"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"The kstring integration in gix-attributes is unsound","id":"GHSA-cx7h-h87r-jpgr","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"memory_corruption","year":"2024"},"n_packages":3,"n_references":null,"packages":[{"ecosystem":"crates.io","fixed":["0.22.3"],"introduced":["0"],"last_affected":[],"package":"gix-attributes","purl":null,"source":"GHSA-cx7h-h87r-jpgr"},{"ecosystem":"crates.io","fixed":["0.22.3"],"introduced":["0"],"last_affected":[],"package":"gix-attributes","purl":"pkg:cargo/gix-attributes","source":"GHSA-cx7h-h87r-jpgr"},{"ecosystem":"crates.io","fixed":["0.22.3"],"introduced":["0.0.0-0"],"last_affected":[],"package":"gix-attributes","purl":"pkg:cargo/gix-attributes","source":"RUSTSEC-2024-0359"}],"products":null,"published":"2024-07-24","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"open","licence":"CC0 1.0","name":"RustSec","prefix":"RUSTSEC"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Unsound UTF-8 handling in gix-attributes exposes invalid strings to dependent crates, potentially causing memory corruption or crashes.","url":"https://insights.sbomify.com/GHSA-cx7h-h87r-jpgr/"}