{"id":"GHSA-3hj7-mch7-c7cc","aliases":["GHSA-3hj7-mch7-c7cc","RUSTSEC-2026-0583"],"related":[],"kind":"vulnerability","state":"published","title":"Panics during RSA private-key construction, validation, or re-encoding","summary":"`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.","summaryFormat":"markdown","summarySource":"rustsec","descriptions":[{"lang":"en","text":"`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.","format":"markdown","source":"rustsec"}],"published":"2026-11-19T12:00:00.000Z","modified":"2026-11-20T13:00:02.895Z","severity":{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.10.4"}],"ecosystem":"crates.io","package":"sad-rsa","purl":"pkg:cargo/sad-rsa","source":"rustsec"}],"references":[{"url":"https://crates.io/crates/sad-rsa","tags":["package"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0583.html","tags":["advisory"],"sources":["rustsec"]},{"url":"https://github.com/sadco-io/sad-rsa/releases/tag/v0.10.4","tags":["web"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0583","url":"https://rustsec.org/advisories/RUSTSEC-2026-0583.html","licence":"CC0-1.0","modified":"2026-11-20T13:00:02.895Z"}],"updatedAt":"2026-11-25T22:56:43.520Z"}