Skip to content
Crypto Audit finding Advanced

Missing modulus bound check in reduction

0xzey Follow with Consigliere, cergyk and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-08-pico-judging/issues/124

Found by

0xzey, Consigliere, cergyk, kimnoic

Summary

The function reduceWithMaxBits does not enforce that the remainder is less than the modulus. This allows an attacker to use a remainder that is >= modulus, which breaks the field arithmetic

Root Cause

The code that checks the remainder against the modulus is commented out. The current code only checks the bit lengths of the limbs but does not check the actual value of the remainder against the modulus.

Internal Pre-conditions

The reduction function reduceWithMaxBits is called when a variable's upper bound is >= modulus. It uses a hint to compute the quotient and remainder, and then checks that x = quotient * modulus + remainder. However, it does not check that remainder < modulus.

External Pre-conditions

The attacker can provide a quotient and remainder that satisfy the equation but with remainder >= modulus.

Attack Path

An attacker can create a variable that is not reduced (i.e., >= modulus) and then use it in the circuit. The circuit would accept it as a valid field element because the reduction function does not enforce the bound

Impact

The field arithmetic would be broken because variables could be outside the field. This could lead to incorrect computations and vulnerabilities in the GNARK.

PoC

Uncomment this liine to implement modulus bound checks on reduction: https://github.com/sherlock-audit/2025-08-pico/blob/main/pico/gnark/koalabear/koalabear.go#L410

Mitigation

Uncomment the modulus bound check for the reduceWithMaxBits function.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/brevis-network/pico/pull/61

The original report as published on Sherlock, by 0xzey. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity crypto bug in Brevis Pico ZKVM. Sherlock made it public on 21 October 2025. Found in the 873 audit contest (finding H-3), also found by 3 other wardens.

About Crypto

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More from Brevis Pico ZKVM

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.