VulnerabilityRUSTSEC-2026-0220 · ruint
RUSTSEC-2026-0220: Uint shift operations: incorrect overflow flags and truncated shift amounts
Short answerA security vulnerability in the ruint crate: Uint shift operations: incorrect overflow flags and truncated shift amounts. No severity score was published. Fixed in 1.20.0: update to a fixed version.
| Crate | ruint |
|---|---|
| Type | Vulnerability (denial-of-service) |
| Affected versions | Before 1.20.0. |
| Fixed in | 1.20.0 |
| Severity | not scored |
| Published | 2026-07-08 |
| Last changed | 2026-07-30 |
| Also known as | none |
| Affected functions | ruint::Uint::checked_shl, ruint::Uint::checked_shr, ruint::Uint::overflowing_shl, ruint::Uint::overflowing_shr, ruint::Uint::saturating_shl, ruint::Uint::saturating_shr, ruint::Uint::wrapping_shl, ruint::Uint::wrapping_shr |
What to do
- See which version you have:
cargo tree -i ruint(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p ruint. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampleruint = "1.20.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
Uint::overflowing_shl/overflowing_shr returned false-negative overflow flags. overflowing_shl missed bits shifted above BITS but within the top limb (non-limb-aligned widths such as U160), and limbs wholly discarded by shifts >= 64; overflowing_shr missed wholly discarded low limbs. Shifted values were correct; only the flag was wrong.
The wrong flag propagates: checked_shl/checked_shr return Some instead of None, strict_* fail to panic, and saturating_* return a wrapped value instead of saturating. The incorrect checked_shl result causes to_base_be (and string formatting) to loop forever on no-alloc builds for non-limb-aligned widths , a denial of service if formatting is reachable from untrusted input.
Separately, wrapping_shl/wrapping_shr on 64/128/256-bit types truncated the shift amount modulo 2^32, so shifts >= 2^32 returned an incorrectly wrapped value instead of zero; on 32-bit targets the generic path also truncated 64-bit shift amounts.
Callers using checked or saturating shift semantics on untrusted shift amounts may compute incorrect results.
References
- Package: crates.io/crates/ruint
- Advisory: rustsec.org/advisories/RUSTSEC-2026-0220.html
- Web: github.com/alloy-rs/ruint/pull/603
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Other advisories for ruint
Up next
Same crateruint: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?