{"id":"RUSTSEC-2026-0603","summary":"X25519 accepts low-order public keys, yielding session keys computable without a private key","details":"Versions of dryoc before 1.0.0 never reject low-order peer public keys or an\nall-zero shared secret. In addition, versions 0.5.1 through 0.9.x compute\nX25519 with the clamped scalar reduced modulo the prime subgroup order ℓ\n(`Scalar::from_bytes_mod_order(clamp(n))`) instead of the clamped integer\nspecified by RFC 7748; earlier versions use the unreduced clamped scalar.\nlibsodium, with which these functions are documented as compatible, returns an\nerror for all of these inputs.\n\nThis affects `crypto_scalarmult`, `crypto_kx_client_session_keys` /\n`crypto_kx_server_session_keys`, `kx::Session::new_*`, and\n`crypto_box_beforenm` together with the box and precalculation APIs built on\nit, whenever the peer public key is not authenticated or can be chosen by a\nmalicious party.\n\n## Impact\n\n- **Predictable session keys.** For the 14 encodings of low-order Curve25519\n  points, the X25519 output is always the all-zero value in versions up to\n  0.5.0, and one of 5 fixed public values in 0.5.1 through 0.9.x. The\n  key-exchange functions return `Ok`, and anyone who knows the two public keys\n  can recompute the resulting session keys (or `crypto_box_beforenm` key) by\n  trying at most 4 candidates. The confidentiality and integrity of that\n  session are lost, including against passive observers.\n- **Small private-key leak (0.5.1 through 0.9.x).** With a peer key that has an\n  order-8 torsion component, the output reveals 2 bits of the victim's static\n  X25519 scalar to the peer (and, when the peer key is an order-8 low-order\n  point, to any observer who can test the candidate session keys). This does\n  not meaningfully reduce the hardness of recovering the key.\n- **Non-standard output (0.5.1 through 0.9.x).** Peer keys with a torsion\n  component, and points on the quadratic twist, produce outputs that differ\n  from RFC 7748 and libsodium, which breaks interoperability for such keys.\n- `KeyPair::is_valid_public_key` accepts 6 of the 14 low-order encodings, so it\n  cannot be relied on as a guard.\n\nApplications that only use authenticated peer keys generated by dryoc or\nlibsodium are not affected in practice: honest keys lie in the prime-order\nsubgroup, where the reduced and unreduced scalars give the same result.\n\n## Resolution\n\nUpgrade to dryoc 1.0.0 or later. In 1.0.0, X25519 is computed with\n`MontgomeryPoint::mul_clamped` (the unreduced clamped scalar, as in RFC 7748),\nand an all-zero shared secret is rejected, so low-order public keys now return\nan error from the scalarmult, box, key-exchange and precalculation APIs. Note\nthat 1.0.0 is a backward-incompatible release; several of these functions now\nreturn `Result`.\n\nIf upgrading is not yet possible, validate every untrusted peer X25519 public\nkey before passing it to dryoc 0.9.x, for example by rejecting keys that do not\nmap to a torsion-free Edwards point (`MontgomeryPoint::to_edwards(0)` followed\nby `is_torsion_free()` in `curve25519-dalek`; this requires `curve25519-dalek`\n4.x as a direct dependency). A check based only on `is_small_order()` prevents\nthe predictable session keys but not the 2-bit leak or the non-standard output.","aliases":["GHSA-6xqm-2982-gvrm"],"modified":"2026-11-27T10:45:03.327197436Z","published":"2026-11-16T12:00:00Z","database_specific":{"license":"CC0-1.0"},"references":[{"type":"PACKAGE","url":"https://crates.io/crates/dryoc"},{"type":"ADVISORY","url":"https://rustsec.org/advisories/RUSTSEC-2026-0603.html"},{"type":"WEB","url":"https://github.com/brndnmtthws/dryoc/pull/139"},{"type":"WEB","url":"https://github.com/brndnmtthws/dryoc/releases/tag/v1.0.0"}],"affected":[{"package":{"name":"dryoc","ecosystem":"crates.io","purl":"pkg:cargo/dryoc"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"1.0.0"}]}],"ecosystem_specific":{"affected_functions":null,"affects":{"os":[],"functions":["dryoc::classic::crypto_box::crypto_box_beforenm","dryoc::classic::crypto_box::crypto_box_detached","dryoc::classic::crypto_box::crypto_box_detached_inplace","dryoc::classic::crypto_box::crypto_box_easy","dryoc::classic::crypto_box::crypto_box_easy_inplace","dryoc::classic::crypto_box::crypto_box_open_detached","dryoc::classic::crypto_box::crypto_box_open_detached_inplace","dryoc::classic::crypto_box::crypto_box_open_easy","dryoc::classic::crypto_box::crypto_box_open_easy_inplace","dryoc::classic::crypto_box::crypto_box_seal","dryoc::classic::crypto_box::crypto_box_seal_open","dryoc::classic::crypto_core::crypto_scalarmult","dryoc::classic::crypto_kx::crypto_kx_client_session_keys","dryoc::classic::crypto_kx::crypto_kx_server_session_keys","dryoc::dryocbox::DryocBox::decrypt","dryoc::dryocbox::DryocBox::decrypt_to_vec","dryoc::dryocbox::DryocBox::encrypt","dryoc::dryocbox::DryocBox::encrypt_to_vecbox","dryoc::dryocbox::DryocBox::seal","dryoc::dryocbox::DryocBox::seal_to_vecbox","dryoc::dryocbox::DryocBox::unseal","dryoc::dryocbox::DryocBox::unseal_to_vec","dryoc::keypair::KeyPair::precalculate","dryoc::kx::Session::new_client","dryoc::kx::Session::new_client_with_defaults","dryoc::kx::Session::new_server","dryoc::kx::Session::new_server_with_defaults","dryoc::precalc::PrecalcSecretKey::precalculate"],"arch":[]}},"database_specific":{"cvss":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N","informational":null,"categories":["crypto-failure"],"source":"https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0603.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"}]}