{"id":"RUSTSEC-2026-0583","aliases":["GHSA-3hj7-mch7-c7cc"],"title":"Panics during RSA private-key construction, validation, or re-encoding","titleSource":"OSV","descriptionSource":"OSV","description":"`RsaPrivateKey` private-key construction, validation, and serialization can panic across three\nclasses of inputs, as well as when re-encoding certain valid keys:\n\n- `RsaPrivateKey::from_components` and PKCS#1 or PKCS#8 private-key decoding (DER or PEM) can panic\n  during validation when a supplied factor equals 1, because `RsaPrivateKey::validate()` let a\n  factor of 1 reach a later check that panicked.\n- `RsaPrivateKey::from_primes` and `RsaPrivateKey::from_p_q` can panic during construction when a\n  supplied factor is 0, 1, or even.\n- Prime recovery in `RsaPrivateKey::from_components` can panic when the private exponent is 0.\n- For a key, including a valid one, whose first prime occupies more limbs than the second,\n  `crt_coefficient`, `to_pkcs1_der`, `to_pkcs8_der`, and `serde` serialization can panic.\n\nAn application that imports untrusted private keys or factors, or re-encodes such keys, can lose a\nworker, or the whole process when built with `panic = \"abort\"`. Public-key parsing is not affected.\n\nFixed in 0.10.4, which rejects factors below 2, even factors, repeated factors, and a zero private\nexponent during prime recovery, and computes the CRT coefficient and re-encodes valid two-prime\nkeys when the first prime occupies more limbs than the second.\n\nIf you cannot upgrade to 0.10.4, isolate the entire import, construction, CRT calculation, or\nserialization in a separate process and treat an abnormal exit as an operation failure, or use\n`catch_unwind` around the entire operation when panics unwind.","severity":"medium","score":5.3,"published":"2026-11-19T12:00:00.000Z","modified":"2026-11-20T13:00:02.895Z","withdrawn":false,"knownExploited":false,"affected":[{"ecosystem":"crates.io","name":"sad-rsa","sources":[{"name":"OSV · RUSTSEC-2026-0583","url":"https://osv.dev/vulnerability/RUSTSEC-2026-0583"}],"ranges":[{"events":[{"introduced":"0.0.0-0"},{"fixed":"0.10.4"}],"type":"SEMVER"}],"versions":[],"fixed":["0.10.4"]}],"sourceAffected":[],"references":["https://crates.io/crates/sad-rsa","https://rustsec.org/advisories/RUSTSEC-2026-0583.html","https://github.com/sadco-io/sad-rsa/releases/tag/v0.10.4"],"sources":[{"name":"OSV","id":"RUSTSEC-2026-0583","modified":"2026-11-20T13:00:02.895297006Z","url":"https://osv.dev/vulnerability/RUSTSEC-2026-0583"}],"assessments":[{"source":"OSV","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3}],"products":[],"remediation":[],"observedAt":"2026-11-20T14:03:05.533Z","kev":{"status":"unavailable","checkedAt":"2026-11-28T23:55:31.062Z"},"coverage":[{"source":"NVD","status":"not-checked"},{"source":"GHSA","status":"not-checked"},{"source":"EUVD","status":"not-checked"},{"source":"EPSS","status":"not-checked"}],"evidence":[],"aiSummary":null}