RUSTSEC-2026-0594 (GHSA-8WCQ-XQ25-7FHM)
Vulnerability from osv_rustsec – Published: 2026-11-23 12:00 – Updated: 2026-11-23 09:36 – Source websiteWho 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 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.
{
"affected": [
{
"database_specific": {
"categories": [
"crypto-failure"
],
"cvss": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N",
"informational": null
},
"ecosystem_specific": {
"affected_functions": null,
"affects": {
"arch": [],
"functions": [
"cookie::PrivateJar::add",
"cookie::PrivateJar::add_original"
],
"os": [
"linux",
"macos",
"freebsd",
"netbsd",
"openbsd",
"dragonfly",
"solaris",
"illumos",
"android",
"ios"
]
}
},
"package": {
"ecosystem": "crates.io",
"name": "cookie",
"purl": "pkg:cargo/cookie"
},
"ranges": [
{
"events": [
{
"introduced": "0.11.3"
},
{
"fixed": "0.12.0"
},
{
"introduced": "0.14.0"
},
{
"fixed": "0.18.3"
}
],
"type": "SEMVER"
}
],
"versions": []
}
],
"aliases": [
"GHSA-8wcq-xq25-7fhm"
],
"database_specific": {
"license": "CC0-1.0"
},
"details": "## Who is affected\n\nOnly applications that call `fork()` and then add private (encrypted) cookies\non the thread that forked, in more than one of the resulting processes. This\nis an uncommon way to deploy a Rust web application. In particular:\n\n * **Rocket is not affected.**\n * **axum is not affected as normally run.** It is affected only when an\n application forks worker processes itself and runs each on a\n current-thread runtime. See \"Rocket and axum\" below.\n * Applications that never fork are not affected. This includes all\n applications on Windows.\n * Signed cookies (`SignedJar`) are not affected.\n\nThe exact conditions are listed under \"Conditions\" below.\n\n## Description\n\nPrivate cookies are sealed with AES-256-GCM using a random 96-bit nonce.\nAffected versions drew the nonce from `rand`\u0027s thread-local generator,\n`rand::thread_rng()`. That generator hands out bytes from an internal buffer\nand only notices that the process has forked when the buffer is refilled. A\nprocess that forks therefore continues, in both the parent and the child, from\nthe same buffered bytes, and the private cookies sealed first on each side of\nthe fork use the same nonces.\n\n## Impact\n\nReusing a nonce under the same key breaks AES-GCM. From two private cookies\nthat share a nonce, an attacker can:\n\n * recover the XOR of the two plaintexts, and thus either plaintext if the\n other is known, and\n * recover the GHASH authentication key and forge private cookies, with a\n name and value of their choosing, that the application accepts as\n authentic.\n\nThe nonce is the first 12 bytes of a private cookie\u0027s (base64-decoded) value,\nso a repeated nonce is visible to anyone who holds two such cookies.\n\nExploitation requires the uncommon deployment described above, and only the\nfirst private cookies added after a fork are affected: at most 21 per process.\nAn attacker must obtain two of them, from two different processes.\n\n## Conditions\n\nAll of the following must hold:\n\n 1. The target is a Unix-like system and the process calls `fork()` without a\n subsequent `exec()`.\n 2. The thread that calls `fork()` used `rand::thread_rng()` at any point\n before the fork. Any use counts, including `Key::generate()`, adding a\n private cookie, or a call made by an unrelated crate.\n 3. After the fork, private cookies are added on that same thread in two or\n more of the resulting processes: the parent and a child, or several\n children.\n 4. Those processes use the same `Key`.\n\nWhen they hold, at most the first 21 private cookies added on that thread in\neach process share nonces. After that the generator reseeds and the processes\ndiverge.\n\nThe following are **not** affected:\n\n * Applications that never fork, including all applications on Windows.\n * Processes in which the forking thread did not use `rand::thread_rng()`\n before the fork.\n * Private cookies added on threads that were created after the fork. This\n includes servers that fork and then start a multi-threaded async runtime\n in each child.\n * Signed cookies (`SignedJar`), which do not use a nonce.\n * Versions `0.12.0` through `0.13.3`, and `0.11.2` and earlier, which\n obtained nonces from the operating system via `ring`.\n\n## Rocket and axum\n\nRocket and axum were tested with `cookie` `0.18.2` by collecting the private\ncookies sent by each server process and comparing their nonces.\n\n**Rocket** (`0.5.4`, `CookieJar::add_private()`) is not affected. Rocket does\nnot fork, and it handles requests on worker threads of a runtime it creates\nwhen launched. No nonce was reused:\n\n * when launched normally, in a single process, or\n * when a parent process used a private cookie and then forked two worker\n processes that each launched Rocket.\n\n**axum** (`0.8.9`, with `PrivateCookieJar` from `axum-extra` `0.12.6`) is not\naffected as normally run. No nonce was reused:\n\n * when run in a single process on a multi-threaded runtime, or\n * when a parent process used a private cookie and then forked two worker\n processes that each started a multi-threaded runtime.\n\nAn axum application is affected only if it does all of the following:\n\n 1. forks worker processes itself,\n 2. runs each worker on a current-thread runtime on the thread that forked,\n so that requests are handled on that thread, and\n 3. used `rand::thread_rng()` on that thread before forking.\n\nIn that configuration, the first private cookies sent by two workers reused\nnonces: 19 when the parent had added one private cookie before forking, and 15\nwhen the parent had only called `Key::generate()`. No nonce was reused when\nthe parent did neither.\n\nOther frameworks and libraries that use this crate\u0027s `PrivateJar` were not\ntested. The conditions above apply to them as well.\n\n## Fix\n\nVersion `0.18.3` obtains nonces directly from the operating system\u0027s random\nnumber generator, which is not affected by `fork`.\n\n## Workarounds\n\nIf upgrading is not possible, any one of the following prevents the reuse:\n\n * Do not use `rand::thread_rng()`, directly or indirectly, on the forking\n thread before forking. In particular, create the `Key` with `Key::from()`\n or `Key::derive_from()` rather than `Key::generate()` before the fork.\n * In each child, immediately after forking, read and discard at least 256\n bytes from `rand::thread_rng()` before adding any private cookie.\n * Add private cookies only on threads created after the fork.\n\nApplications that ran in an affected configuration should rotate their `Key`.",
"id": "RUSTSEC-2026-0594",
"modified": "2026-11-23T09:36:07Z",
"published": "2026-11-23T12:00:00Z",
"references": [
{
"type": "PACKAGE",
"url": "https://crates.io/crates/cookie"
},
{
"type": "ADVISORY",
"url": "https://rustsec.org/advisories/RUSTSEC-2026-0594.html"
},
{
"type": "WEB",
"url": "https://github.com/rwf2/cookie-rs/commit/98de6032defb10ad5e49d83fa1a9bbed1873cbe4"
}
],
"related": [],
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N",
"type": "CVSS_V3"
}
],
"summary": "Private cookie nonces can repeat in processes that fork"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.