RUSTSEC-2026-0594: Private cookie nonces can repeat in processes that fork
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 64/100
Direzione di ricerca
Inizia in Cargo.toml e Cargo.lock; esegui cargo tree -i cookie per vedere se cookie 0.18.2 è una dipendenza diretta o transitiva. Incrementa o aggiorna per far sì che la versione risolta sia almeno 0.18.3, poi esegui cargo build e la suite di test. Fatto significa che cargo tree -i cookie non segnala più una versione affetta e il progetto continua a compilare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Private cookie nonces can repeat in processes that fork
| Details | |
|---|---|
| Package | cookie |
| Version | 0.18.2 |
| URL | https://github.com/rwf2/cookie-rs/commit/98de6032defb10ad5e49d83fa1a9bbed1873cbe4 |
| Date | 2026-11-23 |
| Patched versions | >=0.18.3 |
| Unaffected versions | <0.11.3,>=0.12.0, <0.14.0 |
Who is affected
Only applications that call fork() and then add private (encrypted) cookies
on the thread that forked, in more than one of the resulting processes. This
is an uncommon way to deploy a Rust web application. In particular:
- Rocket is not affected.
- axum is not affected as normally run. It is affected only when an
application forks worker processes itself and runs each on a
current-thread runtime. See "Rocket and axum" below. - Applications that never fork are not affected. This includes all
applications on Windows. - Signed cookies (
SignedJar) are not affected.
The exact conditions are listed under "Conditions" below.
Description
Private cookies are sealed with AES-256-GCM using a random 96-bit nonce.
Affected versions drew the nonce from rand's thread-local generator,
rand::thread_rng(). That generator hands out bytes from an internal buffer
and only notices that the process has forked when the buffer is refilled. A
process that forks therefore continues, in both the parent and the child, from
the same buffered bytes, and the private cookies sealed first on each side of
the fork use the same nonces.
Impact
Reusing a nonce under the same key breaks AES-GCM. From two private cookies
that share a nonce, an attacker can:
- recover the XOR of the two plaintexts, and thus either plaintext if the
other is known, and - recover the GHASH authentication key and forge private cookies, with a
name and value of their choosing, that the application accepts as
authentic.
The nonce is the first 12 bytes of a private cookie's (base64-decoded) value,
so a repeated nonce is visible to anyone who holds two such cookies.
Exploitation requires the uncommon deployment described above, and only the
first private cookies added after a fork are affected: at most 21 per process.
An attacker must obtain two of them, from two different processes.
Conditions
All of the following must hold:
- The target is a Unix-like system and the process calls
fork()without a
subsequentexec(). - The thread that calls
fork()usedrand::thread_rng()at any point
before the fork. Any use counts, includingKey::generate(), adding a
private cookie, or a call made by an unrelated crate. - After the fork, private cookies are added on that same thread in two or
more of the resulting processes: the parent and a child, or several
children. - Those processes use the same
Key.
When they hold, at most the first 21 private cookies added on that thread in
each process share nonces. After that the generator reseeds and the processes
diverge.
The following are not affected:
- Applications that never fork, including all applications on Windows.
- Processes in which the forking thread did not use
rand::thread_rng()
before the fork. - Private cookies added on threads that were created after the fork. This
includes servers that fork and then start a multi-threaded async runtime
in each child. - Signed cookies (
SignedJar), which do not use a nonce. - Versions
0.12.0through0.13.3, and0.11.2and earlier, which
obtained nonces from the operating system viaring.
Rocket and axum
Rocket and axum were tested with cookie 0.18.2 by collecting the private
cookies sent by each server process and comparing their nonces.
Rocket (0.5.4, CookieJar::add_private()) is not affected. Rocket does
not fork, and it handles requests on worker threads of a runtime it creates
when launched. No nonce was reused:
- when launched normally, in a single process, or
- when a parent process used a private cookie and then forked two worker
processes that each launched Rocket.
axum (0.8.9, with PrivateCookieJar from axum-extra 0.12.6) is not
affected as normally run. No nonce was reused:
- when run in a single process on a multi-threaded runtime, or
- when a parent process used a private cookie and then forked two worker
processes that each started a multi-threaded runtime.
An axum application is affected only if it does all of the following:
- forks worker processes itself,
- runs each worker on a current-thread runtime on the thread that forked,
so that requests are handled on that thread, and - used
rand::thread_rng()on that thread before forking.
In that configuration, the first private cookies sent by two workers reused
nonces: 19 when the parent had added one private cookie before forking, and 15
when the parent had only called Key::generate(). No nonce was reused when
the parent did neither.
Other frameworks and libraries that use this crate's PrivateJar were not
tested. The conditions above apply to them as well.
Fix
Version 0.18.3 obtains nonces directly from the operating system's random
number generator, which is not affected by fork.
Workarounds
If upgrading is not possible, any one of the following prevents the reuse:
- Do not use
rand::thread_rng(), directly or indirectly, on the forking
thread before forking. In particular, create theKeywithKey::from()
orKey::derive_from()rather thanKey::generate()before the fork. - In each child, immediately after forking, read and discard at least 256
bytes fromrand::thread_rng()before adding any private cookie. - Add private cookies only on threads created after the fork.
Applications that ran in an affected configuration should rotate their Key.
See advisory page for additional details.
- Lingua principale
- Rust
- Stelle
- 476
- Fork
- 38
- Merge medio
- 9h 35m
- PR unite (30g)
- 8
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di esp-rs/espup
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
enhancement feature request
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Install To Platform-Standard Locations | Reduce Home Directory ClutterForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaenhancement feature request
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
enhancement feature request
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
Tutte le issue di esp-rs/espup
Issue simili
-
Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`Forse già presa @cscheid l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quarto-dev/q2#1419 ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
pbakaus/impeccable#1718 ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged bug bughunt pm:bazel priority:p3 ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SocketDev/socket-patch#2386 ·
I maintainer di solito rispondono entro 1 giorno
-
Uncaught index-out-of-bounds panic in `minijinja::value::ops::slice` on `{{ ''[::-1] }}` (v2.24.0)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Fix All + Enforce overwrites unsaved edits to .editorconfig / Directory.Build.props / sharplsp.tomlApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Nimblesite/SharpLsp#644 ·
I maintainer di solito rispondono entro 1 giorno