rustsec-2026-0220
Vulnerability from osv_rustsec
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.
| URL | Type | |
|---|---|---|
{
"affected": [
{
"database_specific": {
"categories": [
"denial-of-service"
],
"cvss": null,
"informational": null
},
"ecosystem_specific": {
"affected_functions": null,
"affects": {
"arch": [],
"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"
],
"os": []
}
},
"package": {
"ecosystem": "crates.io",
"name": "ruint",
"purl": "pkg:cargo/ruint"
},
"ranges": [
{
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "1.20.0"
}
],
"type": "SEMVER"
}
],
"versions": []
}
],
"aliases": [],
"database_specific": {
"license": "CC0-1.0"
},
"details": "`Uint::overflowing_shl`/`overflowing_shr` returned false-negative overflow\nflags. `overflowing_shl` missed bits shifted above `BITS` but within the top\nlimb (non-limb-aligned widths such as `U160`), and limbs wholly discarded by\nshifts \u003e= 64; `overflowing_shr` missed wholly discarded low limbs. Shifted\nvalues were correct; only the flag was wrong.\n\nThe wrong flag propagates: `checked_shl`/`checked_shr` return `Some` instead\nof `None`, `strict_*` fail to panic, and `saturating_*` return a wrapped\nvalue instead of saturating. The incorrect `checked_shl` result causes\n`to_base_be` (and string formatting) to loop forever on no-alloc builds for\nnon-limb-aligned widths \u2014 a denial of service if formatting is reachable\nfrom untrusted input.\n\nSeparately, `wrapping_shl`/`wrapping_shr` on 64/128/256-bit types truncated\nthe shift amount modulo 2^32, so shifts \u003e= 2^32 returned an incorrectly\nwrapped value instead of zero; on 32-bit targets the generic path also\ntruncated 64-bit shift amounts.\n\nCallers using checked or saturating shift semantics on untrusted shift\namounts may compute incorrect results.",
"id": "RUSTSEC-2026-0220",
"modified": "2026-07-30T19:13:51Z",
"published": "2026-07-08T12:00:00Z",
"references": [
{
"type": "PACKAGE",
"url": "https://crates.io/crates/ruint"
},
{
"type": "ADVISORY",
"url": "https://rustsec.org/advisories/RUSTSEC-2026-0220.html"
},
{
"type": "WEB",
"url": "https://github.com/alloy-rs/ruint/pull/603"
}
],
"related": [],
"severity": [],
"summary": "Uint shift operations: incorrect overflow flags and truncated shift amounts"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.