Skip to content

Fix : Unchecked Witness-Derived Indices Cause Deterministic Prover Panics in RAM and Multiplicity Builders [LA-H]#357

Merged
ashpect merged 1 commit into
mainfrom
aj/main/fix-unchecked-witness-derived-indices
Apr 6, 2026
Merged

Fix : Unchecked Witness-Derived Indices Cause Deterministic Prover Panics in RAM and Multiplicity Builders [LA-H]#357
ashpect merged 1 commit into
mainfrom
aj/main/fix-unchecked-witness-derived-indices

Conversation

@ocdbytes
Copy link
Copy Markdown
Collaborator

@ocdbytes ocdbytes commented Mar 21, 2026

PR Description

Summary

  • Add explicit bounds checks for witness-derived array indices in solve_ram_witness, MultiplicitiesForRange,
    MultiplicitiesForBinOp, and MultiplicitiesForSpread
  • Convert SpiceWitnessesSolver::solve, WitnessBuilderSolver::solve, and solve_witness_vec to return
    anyhow::Result<()> instead of panicking
  • Propagate structured errors through the full call chain up to prove_with_witness

Motivation

Addresses audit finding Issue H: unchecked witness-derived indices allowed malformed witness values to cause
deterministic out-of-bounds panics in the prover, enabling denial-of-service against proof generation.

Vulnerable sites fixed

Location Vulnerability
ram.rs — Load/Store addr.into_bigint().0[0] as usize used to index rt_final/rv_final without bounds check
witness_builder.rsMultiplicitiesForRange value as usize used as index into multiplicities without checking value < range_size
witness_builder.rsMultiplicitiesForBinOp (lhs << atomic_bits) + rhs used as unchecked table index
witness_builder.rsMultiplicitiesForSpread val as usize used as unchecked table index (same pattern, not in audit)

@ashpect ashpect marked this pull request as ready for review April 6, 2026 23:22
@ashpect ashpect merged commit b012750 into main Apr 6, 2026
5 checks passed
dcbuild3r pushed a commit that referenced this pull request May 16, 2026
…erived-indices

Fix : Unchecked Witness-Derived Indices Cause Deterministic Prover Panics in RAM and Multiplicity Builders [LA-H]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants