# RUSTSEC-2026-0236: A `BigInt` division panics, and two neighbouring operations answer wrongly in silence

> A crafted BigInt division in viperjs causes a panic leading to denial of service, while related operations silently return incorrect results.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Aug 2026
- **Also known as:** GHSA-6976-qm5m-7mcj

## What is RUSTSEC-2026-0236?

RUSTSEC-2026-0236 is a denial of service vulnerability in viperjs, published on 6 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

`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:

```js
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:

```js
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](https://github.com/Zniece).

## Which versions are affected by RUSTSEC-2026-0236?

1 open source package ship an affected version, including viperjs.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `viperjs` | crates.io | From 0.0.0-0 | 0.2.2 |

## How do I fix RUSTSEC-2026-0236?

Upgrade viperjs to 0.2.2 or later.

## Is RUSTSEC-2026-0236 being exploited?

There is no known exploitation of RUSTSEC-2026-0236 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for RUSTSEC-2026-0236 and fix it if it is affected.

What it is: RUSTSEC-2026-0236 is a denial of service vulnerability in viperjs, published on 6 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of RUSTSEC-2026-0236 in the wild and no public exploit code.

Affected packages and fixed versions:
- viperjs (crates.io): affected from 0.0.0-0; fixed in 0.2.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/RUSTSEC-2026-0236/ (Markdown: https://insights.sbomify.com/RUSTSEC-2026-0236/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/RUSTSEC-2026-0236

---
From sbomify Insights: https://insights.sbomify.com/RUSTSEC-2026-0236/
Summaries are generated and may contain mistakes; the official description above is the record.
