Truncated public_values causes panic in SP1Prover::verify
A malformed proof can carry a public_values buffer shorter than the expected number of elements. Because the Borrow implementation slices the backing array without a length check before the shard verifier validates the length, verification panics instead of returning an error, allowing a remote denial of service.
Originally disclosed on Code4rena
Submitted by mohamedfahmy
crates/hypercube/src/air/public_values.rs#L192-L201crates/prover/src/verify.rs#L71-L84crates/hypercube/src/verifier/shard.rs#L458-L466
A malformed proof can set ShardProof.public_values.len() to be smaller than the expected number of public value elements. The Borrow implementation for PublicValues slices the backing slice with [0..size] without a release mode length check, causing a panic before verification returns an error.
Borrow impl (unchecked slice): crates/hypercube/src/air/public_values.rs (around lines 192–201)
Early borrows in verifier before shard-level checks: crates/prover/src/verify.rs (for example: lines ~71, 108, 153, 199, 231, 266, 351, 398)
Although the shard verifier later checks public_values.len() < self.machine.num_pv_elts() in crates/hypercube/src/verifier/shard.rs around (lines 458-466), the core verifier borrows the slice earlier, so the panic can occur first.
Impact
Any service exposing SP1Prover::verify can be crashed by submitting a proof with a truncated public_values buffer causing remote DoS.
If built with panic=abort, this aborts the process, otherwise it unwinds and terminates the request path. No forged proof is required, only valid serialization with a short vector.
View detailed Proof of Concept
Recommendation
Add an eager length check in SP1Prover::verify before any as_slice().borrow() calls.
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
Likely the Borrow implementation for PublicValues slices the backing buffer with an unchecked range, and the core verifier borrows it before the shard-level length check runs.
Impact
Any service exposing SP1Prover::verify can be crashed by submitting a proof with a truncated public_values buffer, causing remote DoS; with panic=abort the process aborts, otherwise the request path unwinds.
What the attacker needed
Ability to submit a proof to verify; valid serialisation with short vector
The fix
An eager length check should be added in SP1Prover::verify before any borrow calls.
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.
A verifier checks proofs that users submit. It reads a list of public values from the proof and assumes the list is long enough. If someone sends a shorter list, the program crashes instead of politely rejecting the proof, so an attacker can knock the service offline.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.