MEDIUM · CVSS 3.1 6.5

GHSA-8wcq-xq25-7fhm: Private cookie nonces can repeat in processes that fork

Published 2026-11-23 · Updated 2026-11-23 · Also known as RUSTSEC-2026-0594

Summary

Affected versions of the crates.io cookie crate (0.11.3 before 0.12.0, and 0.14.0 before 0.18.3) draw AES-256-GCM nonces for private cookies from rand::thread_rng(), which can repeat buffered nonces across processes after a fork(). Engineering teams running Unix-like Rust applications that fork() and seal private cookies on the forking thread in multiple processes sharing the same Key should upgrade to a fixed version or apply the documented workarounds.

Who is affected

When a Unix-like process calls fork() without exec() after rand::thread_rng() was used on the forking thread, and two or more resulting processes sharing the same Key add private cookies on that thread, up to the first 21 private cookies per process can reuse nonces. Because repeating an AES-GCM nonce under the same key breaks encryption guarantees, an attacker who obtains two such cookies from different processes (detectable via the first 12 bytes of the base64-decoded value) can recover the XOR of their plaintexts and derive the GHASH authentication key to forge arbitrary authentic private cookies. Applications that never fork (including all Windows applications), signed cookies (SignedJar), Rocket, and axum as normally run with a multi-threaded runtime are not affected.

Exploitability

Based on the CVSS 3.1 vector (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N) and base score of 6.5 (Medium), exploitation is network-accessible without privileges or user interaction, requires high attack complexity, and results in low confidentiality impact, high integrity impact, and no availability impact. EPSS data is not yet available for this record. CISA Known Exploited Vulnerabilities status is no, so active exploitation is not indicated.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-23. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
crates.io cookie >= 0.11.3, < 0.12.0 0.12.0 cargo update -p cookie --precise 0.12.0
crates.io cookie >= 0.14.0, < 0.18.3 0.18.3 cargo update -p cookie --precise 0.18.3

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N

Attack vectorNetwork
Attack complexityHigh
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityLow
IntegrityHigh
AvailabilityNone

FAQ

Are Rocket and axum web applications affected?

Rocket (tested at 0.5.4) is not affected because it does not fork and handles requests on runtime worker threads created when launched. Axum (tested at 0.8.9 with axum-extra 0.12.6) is not affected when run normally on a multi-threaded runtime; it is only affected if the application forks worker processes itself, runs each on a current-thread runtime on the forking thread, and used rand::thread_rng() on that thread before forking.

Are signed cookies (SignedJar) or Windows deployments vulnerable?

No. Signed cookies (SignedJar) do not use a nonce and are unaffected, and applications on Windows-as well as any application that never calls fork()-are not affected.

Why are cookie versions 0.11.2 and earlier and 0.12.0 through 0.13.3 not affected?

Those versions obtained nonces from the operating system via ring instead of rand::thread_rng(). Fixed version 0.18.3 similarly obtains nonces directly from the operating system's random number generator, which is not affected by fork().

Original advisory description
## 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: 1. The target is a Unix-like system and the process calls `fork()` without a subsequent `exec()`. 2. The thread that calls `fork()` used `rand::thread_rng()` at any point before the fork. Any use counts, including `Key::generate()`, adding a private cookie, or a call made by an unrelated crate. 3. 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. 4. 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.0` through `0.13.3`, and `0.11.2` and earlier, which obtained nonces from the operating system via `ring`. ## 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: 1. forks worker processes itself, 2. runs each worker on a current-thread runtime on the thread that forked, so that requests are handled on that thread, and 3. 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 the `Key` with `Key::from()` or `Key::derive_from()` rather than `Key::generate()` before the fork. * In each child, immediately after forking, read and discard at least 256 bytes from `rand::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`.

References

Source records: RUSTSEC-2026-0594 (OSV.dev).