Skip to content
Crypto Audit finding Advanced

`global_cumulative_sum` is not enforced to be zero when combine is complete

The zero-knowledge recursion circuit that combines shards computes a global cumulative sum of send and receive points but never checks that this sum equals zero when the combine is marked complete. An attacker could therefore produce a final combined proof whose public values carry a non-zero global cumulative sum, breaking the invariant that global sends and receives balance out across all shards.

cergyk Follow

Originally disclosed on Sherlock

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

Found by

cergyk

Description

global_cumulative_sum is the sum of points for global sends and receives. It needs to be checked to be zero accross all shards, when shards are combined (i.e in the combine recursion circuit).

Unfortunately, although the global_cumulative_sum is computed and set in the public values, it is not checked to be zero when flag_complete:

combine/builder.rs#L484-L492:

Rust
    // Deferred Proof Digest Completeness Verification
    assert_deferred_digest_complete(builder, compress_public_values, flag_complete);
    compress_public_values.digest =
        recursion_public_values_digest::<CC, SC>(builder, compress_public_values);


    /*
    Commit public values
        */
    SC::commit_recursion_public_values(builder, *compress_public_values);

recursion/public_values.rs#L244-L264:

Rust
pub(crate) fn assert_deferred_digest_complete<C>(
    builder: &mut Builder<C>,
    public_values: &RecursionPublicValues<Felt<C::F>>,
    flag_complete: Felt<C::F>,
) where
    C: CircuitConfig,
{
    let zero: Felt<_> = builder.eval(C::F::ZERO);


    for start_digest in public_values.start_reconstruct_deferred_digest.into_iter() {
        builder.assert_felt_eq(flag_complete * start_digest, zero);
    }

    for (end_digest, expected_digest) in public_values
        .end_reconstruct_deferred_digest
        .into_iter()
        .zip_eq(public_values.deferred_proofs_digest.into_iter())
    {
        builder.assert_felt_eq(flag_complete * (end_digest - expected_digest), zero);
    }
}

Recommendation

Add a check when flag_complete is true for global_cumulative_sum to be zero:

Diff
+   builder.assert_digest_zero(flag_complete, *compress_public_values.global_cumulative_sum);

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 cergyk. 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.

How it worked

Root cause

The completeness check in the combine recursion circuit verifies deferred proof digests but omits an assertion that global_cumulative_sum is zero when flag_complete is set.

Impact

A prover could submit a completed combined proof whose public values show a non-zero global cumulative sum, violating the balance invariant the protocol relies on.

What the attacker needed

Ability to generate shard proofs; crafted non-zero cumulative sum

The fix

The protocol team fixed this by adding an assertion that global_cumulative_sum is zero when flag_complete is true.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

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

This project proves computations with cryptography instead of trusting a server. Work is split into pieces called shards, and a final circuit glues the pieces together. A running total of points sent and received across all shards should end at zero, but the final gluing step never checked that, so a dishonest prover could finish with a total that does not balance.

What is Crypto?

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

More by cergyk

View all

29 more disclosed reports, best first.

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.