Rust advisories / viperjs
Vulnerability HighRUSTSEC-2026-0236 · viperjs
RUSTSEC-2026-0236: A `BigInt` division panics, and two neighbouring operations answer wrongly in silence
Short answerA security vulnerability in the viperjs crate: A `BigInt` division panics, and two neighbouring operations answer wrongly in silence. High severity (CVSS 7.5). Fixed in 0.2.2: update to a fixed version.
| Crate | viperjs |
|---|---|
| Type | Vulnerability (denial-of-service) |
| Affected versions | Before 0.2.2. |
| Fixed in | 0.2.2 |
| Severity | High, CVSS 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| Published | 2026-08-06 |
| Last changed | 2026-10-12 |
| Also known as | GHSA-6976-qm5m-7mcj |
What to do
- See which version you have:
cargo tree -i viperjs(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p viperjs. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampleviperjs = "0.2.2") 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
viperjs is a JavaScript engine intended to run untrusted script inside a host application, so script text is data rather than a trusted caller and a panic reachable from script is a denial of service in the embedder's process.
A divisor whose magnitude lands exactly on the engine's internal limb ceiling reaches an out-of-bounds index. On every released version up to and including 0.2.1:
const d = (1n << 33554399n) * 2n;
1n / d; // panic: index out of bounds
Two further operations on the same value returned wrong results without raising anything, which is the more dangerous half for an embedder that acts on the answer:
d % 7n; // 0n , the true remainder is 1n
String(d); // "0"
Cause
The left-shift helper reserved one limb for the bits a shift may push past the top of the magnitude, measured *that* width against the size ceiling, and then trimmed the reserved limb away again , so a magnitude landing exactly on the ceiling was refused on account of room it does not keep. The division treated that refusal as unreachable and discarded it with unwrap_or_default, leaving an empty divisor magnitude; the subsequent divisor[n - 1] is then an index of usize::MAX.
The crate is #![forbid(unsafe_code)], so this is a panic and not memory unsafety.
Remediation
Upgrade to 0.2.2, in which all three behaviours are fixed: both divisions now produce correct results, and String() of a magnitude beyond what the engine can divide raises a RangeError rather than producing "0" , ECMA-262 ยง6.1.4 requires an implementation that imposes a limit to throw rather than answer something else.
There is no workaround short of upgrading; the values are reachable from any script the embedder evaluates.
Reported by @Zniece.
References
- Package: crates.io/crates/viperjs
- Advisory: rustsec.org/advisories/RUSTSEC-2026-0236.html
- Web: github.com/MerlijnW70/viperjs/commit/92988456c44fe7744c13cba1d891f127b8437f95
- Web: github.com/MerlijnW70/viperjs/releases/tag/v0.2.2
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?