{"answers":{"affected":"7 open source packages ship an affected version, including rand.","exploited":"There is no known exploitation of GHSA-cq8v-f236-94qc in the wild and no public exploit code.","fix":"Upgrade rand to a fixed version for your release line: 0.10.1, 0.8.6 or 0.9.3.","what":"GHSA-cq8v-f236-94qc is a memory corruption vulnerability in rand, published on 9 Apr 2026."},"fix_prompt":"Check this codebase for GHSA-cq8v-f236-94qc and fix it if it is affected.\n\nWhat it is: GHSA-cq8v-f236-94qc is a memory corruption vulnerability in rand, published on 9 Apr 2026. \nExploitation: There is no known exploitation of GHSA-cq8v-f236-94qc in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- rand (crates.io): affected from 0.10.0; fixed in 0.10.1\n- rand (crates.io): affected from 0.10.0; fixed in 0.10.1\n- rand (crates.io): affected from 0.7.0; fixed in 0.8.6, 0.9.3, 0.10.1\n- rand (crates.io): affected from 0.7.0; fixed in 0.8.6\n- rand (crates.io): affected from 0.7.0; fixed in 0.8.6\n- rand (crates.io): affected from 0.9.0; fixed in 0.9.3\n- rand (crates.io): affected from 0.9.0; fixed in 0.9.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-cq8v-f236-94qc/ (Markdown: https://insights.sbomify.com/GHSA-cq8v-f236-94qc/index.md)","id":"GHSA-cq8v-f236-94qc","markdown":"https://insights.sbomify.com/GHSA-cq8v-f236-94qc/index.md","name":"GHSA-cq8v-f236-94qc","record":{"aliases":["RUSTSEC-2026-0097"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution","denial_of_service"],"network_reachable":"unknown","non_default_config":true,"product_category":"Rust random number library","requires_auth":"none","summary":"The rand library causes undefined behavior via aliased mutable references when a custom logger accesses the RNG during reseeding, potentially leading to crashes or code execution.","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":"It has been reported (by [@lopopolo](https://github.com/lopopolo)) that the `rand` library is [unsound](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library) (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met:\n\n- The `log` and `thread_rng` features are enabled\n- A [custom logger](https://docs.rs/log/latest/log/#implementing-a-logger) is defined\n- The custom logger accesses `rand::rng()` (previously `rand::thread_rng()`) and calls any `TryRng` (previously `RngCore`) methods on `ThreadRng`\n- The `ThreadRng` (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data)\n- Trace-level logging is enabled or warn-level logging is enabled and the random source (the `getrandom` crate) is unable to provide a new seed\n\n`TryRng` (previously `RngCore`) methods for `ThreadRng` use `unsafe` code to cast `*mut BlockRng\u003cReseedingCore\u003e` to `\u0026mut BlockRng\u003cReseedingCore\u003e`. When all the above conditions are met this results in an aliased mutable reference, violating the Stacked Borrows rules. Miri is able to detect this violation in sample code. Since construction of [aliased mutable references is Undefined Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html), the behaviour of optimized builds is hard to predict.","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":"Rand is unsound with a custom logger using `rand::rng()`","id":"GHSA-cq8v-f236-94qc","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"memory_corruption","year":"2026"},"n_packages":7,"n_references":null,"packages":[{"ecosystem":"crates.io","fixed":["0.10.1"],"introduced":["0.10.0"],"last_affected":[],"package":"rand","purl":null,"source":"GHSA-cq8v-f236-94qc"},{"ecosystem":"crates.io","fixed":["0.10.1"],"introduced":["0.10.0"],"last_affected":[],"package":"rand","purl":"pkg:cargo/rand","source":"GHSA-cq8v-f236-94qc"},{"ecosystem":"crates.io","fixed":["0.8.6","0.9.3","0.10.1"],"introduced":["0.7.0","0.9.0","0.10.0"],"last_affected":[],"package":"rand","purl":"pkg:cargo/rand","source":"RUSTSEC-2026-0097"},{"ecosystem":"crates.io","fixed":["0.8.6"],"introduced":["0.7.0"],"last_affected":[],"package":"rand","purl":null,"source":"GHSA-cq8v-f236-94qc"},{"ecosystem":"crates.io","fixed":["0.8.6"],"introduced":["0.7.0"],"last_affected":[],"package":"rand","purl":"pkg:cargo/rand","source":"GHSA-cq8v-f236-94qc"},{"ecosystem":"crates.io","fixed":["0.9.3"],"introduced":["0.9.0"],"last_affected":[],"package":"rand","purl":null,"source":"GHSA-cq8v-f236-94qc"},{"ecosystem":"crates.io","fixed":["0.9.3"],"introduced":["0.9.0"],"last_affected":[],"package":"rand","purl":"pkg:cargo/rand","source":"GHSA-cq8v-f236-94qc"}],"products":null,"published":"2026-04-09","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":"The rand library causes undefined behavior via aliased mutable references when a custom logger accesses the RNG during reseeding, potentially leading to crashes or code execution.","url":"https://insights.sbomify.com/GHSA-cq8v-f236-94qc/"}