RUSTSEC-2026-0583: Panics during RSA private-key construction, validation, or re-encoding

Medium CVSS 5.3

OSV id
RUSTSEC-2026-0583
Also known as
GHSA-3hj7-mch7-c7cc
Published
Last modified

Affected packages

PackageAffected versionsFixed in
sad-rsa
Cargo
>= 0.0.0-0, < 0.10.4 0.10.4

How to fix it

Upgrade sad-rsa to 0.10.4 or later.

cargo update -p sad-rsa --precise 0.10.4
  • If it is an indirect dependency, `cargo update -p` still works; if a parent crate pins an older version, upgrade that crate.
  • Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.

Not sure whether your project uses an affected version? Check your lockfile below for free.

Details

RsaPrivateKey private-key construction, validation, and serialization can panic across three classes of inputs, as well as when re-encoding certain valid keys:

  • RsaPrivateKey::from_components and PKCS#1 or PKCS#8 private-key decoding (DER or PEM) can panic during validation when a supplied factor equals 1, because RsaPrivateKey::validate() let a factor of 1 reach a later check that panicked.
  • RsaPrivateKey::from_primes and RsaPrivateKey::from_p_q can panic during construction when a supplied factor is 0, 1, or even.
  • Prime recovery in RsaPrivateKey::from_components can panic when the private exponent is 0.
  • For a key, including a valid one, whose first prime occupies more limbs than the second, crt_coefficient, to_pkcs1_der, to_pkcs8_der, and serde serialization can panic.

An application that imports untrusted private keys or factors, or re-encodes such keys, can lose a worker, or the whole process when built with panic = "abort". Public-key parsing is not affected.

Fixed in 0.10.4, which rejects factors below 2, even factors, repeated factors, and a zero private exponent during prime recovery, and computes the CRT coefficient and re-encodes valid two-prime keys when the first prime occupies more limbs than the second.

If you cannot upgrade to 0.10.4, isolate the entire import, construction, CRT calculation, or serialization in a separate process and treat an abnormal exit as an operation failure, or use catch_unwind around the entire operation when panics unwind.

References

Am I affected?

Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.

or paste its content

Needed when you paste. package.json and pyproject.toml only have version ranges: use the lockfile next to them.

Only package names and versions are checked; the file itself is not kept. We use your email to send this report and nothing else unless you tick the box above. Privacy policy.

About this data

Source: RustSec Advisory Database via OSV.dev (CC0 1.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.