Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

RUSTSEC-2026-0097: Rand is unsound with a custom logger using `rand::rng()`

Abierto
#55 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

@noahjoeris ya está trabajando en esto.

Desde el 28/10/2026.

  • #70 de @noahjoeris — abierto

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
rust
Área
backend, security

Línea de trabajo

Start by reading the linked rand advisory at https://github.com/rust-random/rand/pull/1763 and check how this repository depends on or configures rand. The report describes undefined behavior in rand under specific logger and feature conditions but does not say what change this repository should make. Done is unclear from the issue text alone.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Details
Package rand
Version 0.8.5
Warning unsound
URL https://github.com/rust-random/rand/pull/1763
Patched Versions >=0.10.1 OR <0.10.0, >=0.9.3 OR <0.9.0, >=0.8.6
Unaffected Versions <0.7.0
Aliases GHSA-cq8v-f236-94qc

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.

Lenguaje dominante
Rust
Estrellas
10
Forks
8
Merge medio
6 d 3 h
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bitcoindevkit/electrum_streaming_client

Todos los issues de bitcoindevkit/electrum_streaming_client

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.