[M-2] Unchecked try_into unwrap may panic
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- rust
- Domain
- cryptography, security
Research direction
Start in provekit/verifier/src/whir_r1cs.rs and inspect the try_into().unwrap() calls at lines 100–103 and 148–150 in the dual- and single-commitment paths. Trace the verifier error type and conversion patterns used nearby, then exercise malformed hint-vector inputs. Done means incorrect prover-controlled lengths return a controlled verification error instead of panicking.
Written by the indexing model from the issue text.
Description
Context: provekit/verifier/src/whir_r1cs.rs
Description
The verifier uses try_into().unwrap() on prover-controlled hint vectors to convert them into fixed-size arrays (e.g., [FieldElement; 3]). If a maliciously crafted proof provides hint vectors of incorrect length, these unwrap calls will panic, crashing the verifier.
Affected code paths:
- Dual-commitment mode: lines 100–103
- Single-commitment mode: lines 148–150
A malicious prover can exploit this to perform a denial-of-service attack by sending malformed proofs that trigger the unwrap panics.
- Impacted code
let whir_sums_1: ([FieldElement; 3], [FieldElement; 3]) = (sums_1.0.try_into().unwrap(), sums_1.1.try_into().unwrap());
...
let whir_sums: ([FieldElement; 3], [FieldElement; 3]) = (sums.0.try_into().unwrap(), sums.1.try_into().unwrap());
Recommendation
Replace try_into().unwrap() with fallible conversions that return an error (for example, using try_into().context(...) or ensure!) so that malformed proofs produce a controlled verification error rather than a panic.
- Dominant language
- Noir
- Stars
- 138
- Forks
- 47
- Avg merge
- 1d 34m
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from worldfnd/provekit
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
All issues in worldfnd/provekit
Similar issues
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
IBM/OpenJCEPlus#1822 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
objects
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
snapshot-labs/snapshot.js#1247 · 1 comment ·