Skip to content

← Public intelligence

crates.io package

rand

Open actionable advisories and recorded vendor fixes. This public package view has no inventory attached and cannot establish whether your deployment is affected. A vendor fix never resolves your finding; verify your installed version and the source guidance.

Open advisories

1 actionable advisory, newest first. Withdrawn advisories and news are excluded. Coverage is partial.

  1. Unratedcrates.ioPublished

    Rand is unsound with a custom logger using rand::rng()

    GHSA-cq8v-f236-94qc

    Affected
    • crates.io rand >= 0.10.0, <= 0.10.0; >= 0.9.0, < 0.9.3; >= 0.7.0, < 0.8.6
    Fixed in
    0.9.30.8.60.10.1· Vendor fix available
    Issue
    It has been reported (by @lopopolo) that the rand library is unsound (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met: - The log and threadrng features are enabled - A custom logger is defined - The custom logger accesses rand::rng() (previously rand::threadrng()) and calls any TryRng (previously RngCore) methods on ThreadRng - The ThreadRng (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data) - 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 TryRng (previously RngCore) methods for ThreadRng use unsafe code to cast mut BlockRng<ReseedingCore to &mut BlockRng<ReseedingCore. 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…

    Recommended action: Upgrade to 0.10.1, 0.9.3 or 0.8.6 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →