# Truncated public_values causes panic in SP1Prover::verify

Malformed SP1 proof with truncated public_values triggers an unchecked slice borrow panic in SP1Prover::verify before length validation, crashing verifier services.

- Payout: Contest reward
- Severity: medium
- Program: Succinct
- Credited: mohamedfahmy
- Disclosed: 2026-02-18
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2025-09-succinct#m-02
- Library page: https://bugbountylibrary.com/r/c4%3A2025-09-succinct%3AM-02
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:rust technique:source-review vuln:dos vuln:memory-corruption

**Target:** SP1Prover::verify / PublicValues Borrow impl (Rust)
**Root cause:** The Borrow impl for PublicValues slices the backing buffer with [0..size] without a release-mode length check, and the core verifier borrows the slice before the shard verifier's num_pv_elts length check runs.
**Steps:**
1. Craft a ShardProof with public_values.len() smaller than machine.num_pv_elts()
2. Serialize it as a valid proof and submit to a service exposing SP1Prover::verify
3. Verifier calls as_slice().borrow() early (verify.rs ~L71) slicing [0..size] out of bounds
4. Panic occurs before shard.rs L458 length check returns an error
**How found:** Code review of the verifier flow: noticed the Borrow impl slices unchecked and that core verifier borrows public_values before the shard-level num_pv_elts length check, so a short vector panics first.
**Exploitation:** Submit a validly serialized proof with a short public_values vector to any endpoint calling SP1Prover::verify; the early borrow panics, unwinding the request path or aborting the process under panic=abort, yielding remote DoS without a forged proof.
**Insight:** When a length check exists downstream, verify no earlier code path borrows/indexes the same buffer before that check; unchecked Borrow/slice impls are prime panic-DoS candidates in verifier entrypoints.
