Cerin Amroth · Security Disclosures

← all disclosures

Three zkVMs, one missing constraint: division that proves the wrong remainder

Author Paul Jordan Anderson  ·  Project Pico (Brevis), ZisK, Venus (Cysic)  ·  Class CWE-682 (Incorrect Calculation), under-constrained circuit  ·  Severity Critical (soundness)  ·  Reported 2026-06-06  ·  Fixed 2026-09-18

Three zkVMs enforced the division identity and left part of the remainder rule computed but never asserted. Each constraint set admitted a wrong quotient or remainder. All three are now fixed.

Affected Pico divrem chip at brevis-network/pico 22b0aae6; ZisK arithmetic state machine at 0xPolygonHermez/zisk 6182c8be; Venus arithmetic state machine at cysic-labs/venus 130de8f2 (the repository is now cysic-zk/venus) · Fixed Pico v2.1.2 (PR #111); ZisK 683e6d9; Venus v0.3.1 (7530178) · Reporter Paul Jordan Anderson, jordan@cerinamroth.com

Summary

A zero-knowledge virtual machine makes one promise: if the proof verifies, the program ran correctly. Nobody downstream re-executes—not the verifier, not the rollup, not the bridge. So whatever the division chip accepts about a division is that division for everyone who trusts the proof.

RISC-V integer division has one correct quotient and remainder. Two facts pin it together: the identity dividend = divisor·quotient + remainder, and the remainder rule—|remainder| < |divisor|, and for signed operations the remainder takes the dividend's sign. The identity alone is satisfied by a whole family of pairs. Only the remainder rule collapses the family to one.

All three of these zkVMs got the identity right and left part of the remainder rule unasserted. They are one class and two distinct omissions. Pico dropped the magnitude bound. ZisK dropped the sign rule for negative dividends. Venus is a fork of ZisK and shipped the same files until v0.3.1.

Pico: the bound is computed, never asserted

The Pico finding is a confirmed independent rediscovery. It claims no novelty, no CVE and no credit. Brevis already had the fix from a Nethermind audit, in PR #101 of brevis-network/pico (opened 2026-05-20, fix commit "fix(alu): enforce remainder < divisor in divrem constraints"). That PR was still open when this was reported, so the bug was live on main at 22b0aae6.

Pico's divrem chip binds the identity through a MulGadget, which leaves |remainder| < |divisor| as the only thing pinning the result. It hands that to LtWordU16Gadget:

// vm/src/chips/gadgets/lt_word_u16.rs, LtWordU16Gadget::eval (L172-193)
builder.assert_bool(cols.bit);                       // L179: bit is boolean, and only boolean
let base = CB::Expr::from_canonical_u32(1 << 16);    // L180
let diff = a - b + cols.bit * base;                  // L181
//   If a <  b, then bit must be one  for diff to be in [0, 2^16).
//   If a >= b, then bit must be zero for diff to be in [0, 2^16).
builder.looking_rangecheck(ByteOpcode::U16Range, diff, …, is_real);   // L186-193

That is a consistency gadget, not an assertion: (bit = 1, a < b) and (bit = 0, a >= b) both satisfy it. Getting a strict less-than out of it is the caller's job, one assert_one(bit), and the chip never made the call:

// vm/src/chips/chips/alu/divrem/constraints.rs:558-564
// Dispatch abs(remainder) < max(abs(c), 1), equivalent to abs(remainder) < abs(c)
// if not division by 0.
LtWordU16Gadget::<CB::F>::eval(
    builder,
    local_abs_remainder.map(|v| v.into()),
    local_max_abs_c_or_1.map(|v| v.into()),
    local_remainder_lt_gadget,
    local_remainder_check_multiplicity.into(),
);

remainder_lt_gadget appears in four places in the repository—declared, populated, destructured, evaluated—and its .bit is never asserted to be one. The multiplicity argument is (1 - is_c_0) * is_real, which is one for an ordinary division, so the gadget runs and still accepts the forgery. The asserting primitives sat one file over, unused: AssertLtColsBytes and AssertLtColsBits in lt.rs. It reads like a porting regression: a less-than primitive swapped for a same-shaped one that only computes the bit.

So REMU 10 / 3 could be proven as remainder 4, 7 or 10 by choosing quotient 2, 1 or 0. The identity holds for each.

ZisK: the remainder's sign goes free

ZisK verifies division on magnitudes and carries the signs as boolean flags, with a generated table deciding which combinations are legal. The rule that the remainder takes the dividend's sign was written in a comment and enforced only in the division-by-zero case. On the ordinary path the table required nr <= np and nothing more, so a negative dividend left the remainder's sign flag free: REM(-7, 3) could be proven as +1.

The full account has its own page: ZisK: a missing sign constraint in signed remainder. The fix, PR #1228, was written for Cody Gunton's sibling report of the unpinned quotient sign and closed this hole too. The ZisK team then accepted and published GHSA-qjgg-fcj3-p9x3, rated Critical.

Venus (Cysic): the same omission, inherited from a fork, fixed in v0.3.1

Venus is a fork of ZisK, and until v0.3.1 its arithmetic state machine was the upstream one, unchanged. Venus's arith_table.pil and arith.pil were byte-identical to the ZisK files that carried the bug (MD5 5ad47a52... and 28ba3613... on both sides). They arrived in commit 572f54f9 ("[init] monorepo rebump from 0.16", 2026-03-24) and were not modified in any public release through v0.3.0 (2026-09-07).

So a Venus build before v0.3.1 had ZisK's under-constraint exactly. The sign bits na/nb/nr/np are prover-supplied witness columns, and for a negative dividend nothing bound the remainder sign nr to the dividend sign np. The same forged witness worked:

1. Operation flags for signed 64-bit REM -7 / 3.
2. Commit (div=1, signed=1, na=1, nb=0, np=1, nr=0), magnitudes 2 and 1.
3. The magnitude identity 7 = 2*3 + 1 holds.
4. The bound 1 < 3 holds.
5. No sign-table rule rejects the row.
6. The circuit emits REM(-7, 3) = +1 instead of -1.

The fix. Venus v0.3.1 (published 2026-09-18 02:51 UTC; commit 7530178, "Fix signed remainder sign constraint") adds one constraint to arith.pil and arith_mul64.pil:

div * np * (1 - nr) * sum_all_ds === 0;

sum_all_ds is the sum of the range-checked remainder chunks. When the dividend is negative and the remainder is claimed non-negative, every remainder chunk must be zero. That rejects the forged REM(-7, 3) = +1 and still accepts the honest exact division REM(-6, 3) = 0. The release adds regression tests for REM and REMW, covering both the forged positive remainder and the valid zero remainder.

This is a different fix from upstream's. ZisK added a remainder_is_zero flag and rebuilt the sign table (commit 683e6d9, 2026-07-29). Cysic's v0.3.1 change is smaller and gets the zero-remainder case right. The one-line rule in the original report did not: rejecting every np != nr on the signed path would also have rejected honest exact divisions. Later Venus releases changed form again; as of v0.5.0, arith.pil binds a remainder_is_zero flag as upstream does.

Who needs to act. Anyone running a Venus build older than v0.3.1 should upgrade. The release notes say verifier inputs and proof format are unchanged, and that proving keys and setup artifacts must be regenerated for the updated circuit.

Vendor response. The finding was reported to Cysic by email on 2026-06-08, and that report had no reply. A follow-up went out on 2026-09-17, the day the ZisK team published its advisory, and the Cysic team replied the same day. Cysic said the fix had been made privately when the report first arrived, and they published it as v0.3.1 that day.

Scope caveat. The Venus result is verified at the constraint level. The pre-fix files are byte-identical to ZisK's, and the fix is described from the public v0.3.1 diff and release notes. No Venus prover was run, either to produce an accepted forged proof before the fix or to confirm the rejection after it.

Venus is also the clearest illustration of why this class matters beyond one project. A soundness omission in a forked zkVM does not stay in one repository. It travels with the fork into every downstream until that downstream fixes it.

What the fixes teach

Pico's fix is the missing call. At v2.1.2, constraints.rs:598 reads assert_one(local_remainder_lt_gadget.bit).

ZisK's fix is more interesting, because the one-line fix this report proposed was wrong. The report said: reject np != nr on the signed path. That also rejects honest exact divisions, where a negative dividend has a remainder of zero and zero has no sign. The old table allowed nr = 0 under a negative dividend for exactly that reason. What it lacked was anything tying nr = 0 to the remainder actually being zero. ZisK's commit 683e6d9, prompted by Cody Gunton's report of the same gap on the quotient's sign, adds result_is_zero and remainder_is_zero flags, binds each to its value in arith.pil, and makes the table demand a negative remainder whenever the dividend is negative and the flag is clear. The Venus report carried the same one-line fix, and Cysic did not take it either: v0.3.1 added the smaller constraint described above, which also gets the zero case right.

The pattern across all three: a value the circuit needs is computed into a column, range-checked or made boolean, and then used—without the one constraint that says what it must equal. Every piece looks handled. Reading the constraint list for what is asserted, not for what is computed, is what finds it.

Impact

There is no second divider. The on-chain verifier checks the proof's algebra, the settlement contract reads the proven output, the bridge releases against the proven state root, and none of them re-divides. A wrong division becomes final when the proof is accepted. That makes each of these Critical by class.

Scope, stated plainly

Disclosure timeline

Good-faith coordinated disclosure throughout, each report made unconditionally. No bounty program covered any of the three.