This PR contains the following updates:
| Package |
Type |
Update |
Change |
| rand (source) |
dependencies |
patch |
0.10.0 → 0.10.1 |
Rand is unsound with a custom logger using rand::rng()
RUSTSEC-2026-0097
More information
Details
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 thread_rng features are enabled
- A custom logger is defined
- The custom logger accesses
rand::rng() (previously rand::thread_rng()) 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 mutable references is Undefined Behaviour, the behaviour of optimized builds is hard to predict.
Affected versions of rand are >= 0.7, < 0.9.3 and 0.10.0.
Severity
Unknown
References
This data is provided by OSV and the Rust Advisory Database (CC0 1.0).
Release Notes
rust-random/rand (rand)
Compare Source
This release includes a fix for a soundness bug; see #1763.
Changes
- Document panic behavior of
make_rng and add #[track_caller] (#1761)
- Deprecate feature
log (#1763)
Configuration
📅 Schedule: (UTC)
- Branch creation
- Automerge
- Between 12:00 AM and 03:59 AM (
* 0-3 * * *)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [rand](https://rust-random.github.io/book) ([source](https://github.com/rust-random/rand)) | dependencies | patch | `0.10.0` → `0.10.1` |
---
### Rand is unsound with a custom logger using `rand::rng()`
[RUSTSEC-2026-0097](https://rustsec.org/advisories/RUSTSEC-2026-0097.html)
<details>
<summary>More information</summary>
#### Details
It has been reported (by @​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:
- The `log` and `thread_rng` features are enabled
- A [custom logger](https://docs.rs/log/latest/log/#implementing-a-logger) is defined
- The custom logger accesses `rand::rng()` (previously `rand::thread_rng()`) 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 mutable references is Undefined Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html), the behaviour of optimized builds is hard to predict.
Affected versions of `rand` are `>= 0.7, < 0.9.3` and `0.10.0`.
#### Severity
Unknown
#### References
- [https://crates.io/crates/rand](https://crates.io/crates/rand)
- [https://rustsec.org/advisories/RUSTSEC-2026-0097.html](https://rustsec.org/advisories/RUSTSEC-2026-0097.html)
- [https://github.com/rust-random/rand/pull/1763](https://github.com/rust-random/rand/pull/1763)
This data is provided by [OSV](https://osv.dev/vulnerability/RUSTSEC-2026-0097) and the [Rust Advisory Database](https://github.com/RustSec/advisory-db) ([CC0 1.0](https://github.com/rustsec/advisory-db/blob/main/LICENSE.txt)).
</details>
---
### Release Notes
<details>
<summary>rust-random/rand (rand)</summary>
### [`v0.10.1`](https://github.com/rust-random/rand/blob/HEAD/CHANGELOG.md#0101--2026年02月11日)
[Compare Source](https://github.com/rust-random/rand/compare/0.10.0...0.10.1)
This release includes a fix for a soundness bug; see [#​1763].
##### Changes
- Document panic behavior of `make_rng` and add `#[track_caller]` ([#​1761])
- Deprecate feature `log` ([#​1763])
[#​1761]: https://github.com/rust-random/rand/pull/1761
[#​1763]: https://github.com/rust-random/rand/pull/1763
</details>
---
### Configuration
📅 **Schedule**: (UTC)
- Branch creation
- ""
- Automerge
- Between 12:00 AM and 03:59 AM (`* 0-3 * * *`)
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDQuNCIsInVwZGF0ZWRJblZlciI6IjQzLjEwNC40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->