Skip to content

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

Draft
ocdbytes wants to merge 1 commit intov1from
aj/v1/fix-unchecked-witness-derived-indices
Draft

Fix : Unchecked Witness-Derived Indices Cause Deterministic Prover Panics in RAM and Multiplicity Builders [LA-H] #358
ocdbytes wants to merge 1 commit intov1from
aj/v1/fix-unchecked-witness-derived-indices

Conversation

@ocdbytes
Copy link
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 added LA-audit and removed LA-audit labels Mar 21, 2026
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