CVE-2026-140014: cookie Private Cookie Nonces Can Repeat Vulnerability

MODERATE
Advisory Identifier: GHSA-8wcq-xq25-7fhm
CVSS 6.5
CWE-323
Published
Advisory Summary

CVE-2026-140014 is a MODERATE (CVSS 6.5) private cookie nonces can repeat vulnerability (CWE-323: Reusing a Nonce, Key Pair in Encryption) affecting cookie libraries in the crates.io ecosystem. The issue involves private cookie nonces can repeat in processes that fork. Remediation is available by upgrading affected packages to version 0.18.3.

CVE-2026-140014 at a Glance

CVE Identifier CVE-2026-140014
GHSA Identifier GHSA-8wcq-xq25-7fhm
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-323: Reusing a Nonce, Key Pair in Encryption
Affected Product cookie
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-140014

To remediate this vulnerability, upgrade all affected cookie dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

cookie fixed: 0.18.3
Upgrade cookie to 0.18.3
cookie fixed: 0.18.3
Upgrade cookie to 0.18.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for cookie

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-140014, inspect your project dependencies for cookie:

inspect dependencies for cookie

Analyze the terminal output to locate any version of cookie in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.18.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-323: Reusing a Nonce, Key Pair in Encryption, where nonces should be used for the present occasion and only once. In cookie, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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`.

CVE-2026-140014 Affected cookie Versions

2 component(s)
Fixed Versions:
0.18.3
Product / Package Ecosystem Affected Versions Fixed Version
cookie
crates.io
≥ 0.14.0
< 0.18.3
0.18.3
cookie
crates.io
≥ 0.11.3
< 0.18.3
0.18.3

References

Frequently Asked Questions

What is CVE-2026-140014?
CVE-2026-140014 is a security vulnerability in cookie involving Private cookie nonces can repeat in processes that fork under CWE-323: Reusing a Nonce, Key Pair in Encryption.
Which cookie versions are affected?
Affected versions include releases prior to 0.18.3 across affected packages: cookie.
What version fixes CVE-2026-140014?
Upgrading to 0.18.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cookie affected?
Yes, cookie is affected in releases prior to 0.18.3. Upgrade your dependency to 0.18.3 or later.
What is the CVSS score of CVE-2026-140014?
CVE-2026-140014 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N.
What CWE is associated with CVE-2026-140014?
CVE-2026-140014 is classified under CWE-323: Reusing a Nonce, Key Pair in Encryption (Nonces should be used for the present occasion and only once.).
How can I check crates.io dependencies for CVE-2026-140014?
Run the dependency tree command: 'inspect dependencies for cookie'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-8wcq-xq25-7fhm",
  "modified" : "2026-12-01T19:00:12Z",
  "published" : "2026-12-01T19:00:12Z",
  "aliases" : [ "CVE-2026-140014" ],
  "summary" : "cookie: Private cookie nonces can repeat in processes that fork",
  "details" : "## Who is affected\n\nOnly 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:\n\n * **Rocket is not affected.**\n * **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.\n * Applications that never fork are not affected. This includes all 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. 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.\n\n## Impact\n\nReusing a nonce under the same key breaks AES-GCM. From two private cookies that share a nonce, an attacker can:\n\n * recover the XOR of the two plaintexts, and thus either plaintext if the other is known, and\n * recover the GHASH authentication key and forge private cookies, with a name and value of their choosing, that the application accepts as authentic.\n\nThe 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.\n\nExploitation 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.\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 subsequent `exec()`.\n 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.\n 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.\n 4. Those processes use the same `Key`.\n\nWhen 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.\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()` before the fork.\n * 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.\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 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 cookies sent by each server process and comparing their nonces.\n\n**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:\n\n * when launched normally, in a single process, or\n * when a parent process used a private cookie and then forked two worker processes that each launched Rocket.\n\n**axum** (`0.8.9`, with `PrivateCookieJar` from `axum-extra` `0.12.6`) is not affected 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 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, 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 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.\n\nOther frameworks and libraries that use this crate's `PrivateJar` were not tested. The conditions above apply to them as well.\n\n## Fix\n\nVersion `0.18.3` obtains nonces directly from the operating system's random number 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 thread before forking. In particular, create the `Key` with `Key::from()` or `Key::derive_from()` rather than `Key::generate()` before the fork.\n * In each child, immediately after forking, read and discard at least 256 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`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "cookie"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.14.0"
      }, {
        "fixed" : "0.18.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "cookie"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.11.3"
      }, {
        "fixed" : "0.18.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 0.12.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rwf2/cookie-rs/security/advisories/GHSA-8wcq-xq25-7fhm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140014"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rwf2/cookie-rs/commit/4a5e0f31fa18731cb8270090f1d173679bca913c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rwf2/cookie-rs/commit/98de6032defb10ad5e49d83fa1a9bbed1873cbe4"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rwf2/cookie-rs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rwf2/cookie-rs/releases/tag/0.18.3"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2026-0594.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-323" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T19:00:12Z",
    "nvd_published_at" : "2026-11-30T22:17:31Z"
  }
}