PLONK/Groth16 verifiers accept proofs with untrusted recursion vk root
The PLONK and Groth16 final verification helpers parse the recursion verification-key root from the proof's public inputs but never check it against the prover's trusted allowlist root. A malicious prover could therefore certify proofs built on an unauthorised recursion verification-key tree, potentially certifying invalid executions.
Matte Follow with mohamedfahmy and niffylord
Originally disclosed on Code4rena
Submitted by Matte, also found by mohamedfahmy and niffylord
crates/prover/src/verify.rs #L565-L624
The BN254 final verification helpers verify_plonk_bn254() and verify_groth16_bn254() in @crates/prover/src/verify.rs parse vk_root, proof_nonce, and other public inputs from proof.public_inputs, invoke the scheme verifier (PLONK/Groth16), and then re-check only the verifying key hash and the SP1 public values hash via verify_plonk_bn254_public_inputs() / verify_groth16_bn254_public_inputs(). Neither function enforces that the public vk_root equals the trusted recursion verification-key allowlist root maintained by the prover (self.recursion_prover.recursion_vk_root).
Both verify_plonk_bn254() and verify_groth16_bn254() omit an equality check between the parsed vk_root and the prover’s trusted recursion_vk_root. Because vk_root is carried as a public input and the SP1 public values hash does not attest the allowlist root against a trusted reference here, a prover can generate wrap + final proofs using an unauthorized recursion vk tree while keeping all internal cryptographic checks consistent. The helpers will still accept such proofs since only the vkey hash and public-values hash are re-validated.
A malicious could prover construct a recursion Merkle tree containing unauthorized verification keys (e.g., recursion circuits that omit critical constraints), produces wrap plus PLONK/Groth16 proofs referencing that altered vk_root, and submits them for verification. Since neither final verifier cross-checks vk_root against recursion_vk_root, these proofs are accepted, bypassing the recursion vk allowlist and allowing arbitrary, potentially invalid executions to be certified (e.g., for onchain verification).
Recommendation
Add explicit equality checks in both verify_plonk_bn254() and verify_groth16_bn254() to ensure the parsed public vk_root matches self.recursion_prover.recursion_vk_root (converted to the BN254 field representation). Optionally enforce caller-provided expectations for exit_code and proof_nonce before returning success.
--- a/crates/prover/src/verify.rs
+++ b/crates/prover/src/verify.rs
@@ -589,6 +589,13 @@ impl<C: SP1ProverComponents> SP1Prover<C> {
)?;
+ // Enforce vk_root matches the trusted recursion allowlist root.
+ let expected_vk_root =
+ sp1_primitives::koalabears_to_bn254(&self.recursion_prover.recursion_vk_root)
+ .as_canonical_biguint();
+ if vk_root != expected_vk_root {
+ return Err(anyhow::anyhow!("vk_root mismatch"));
+ }
verify_plonk_bn254_public_inputs(vk, public_values, &proof.public_inputs)?;
Ok(())
@@ -619,6 +626,13 @@ impl<C: SP1ProverComponents> SP1Prover<C> {
)?;
+ // Enforce vk_root matches the trusted recursion allowlist root.
+ let expected_vk_root =
+ sp1_primitives::koalabears_to_bn254(&self.recursion_prover.recursion_vk_root)
+ .as_canonical_biguint();
+ if vk_root != expected_vk_root {
+ return Err(anyhow::anyhow!("vk_root mismatch"));
+ }
verify_groth16_bn254_public_inputs(vk, public_values, &proof.public_inputs)?;
Ok(())
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
The final verifiers re-check the verifying key hash and public values hash but omit an equality check between the parsed public `vk_root` and the trusted `recursion_vk_root`.
Impact
Proofs built on an unauthorised recursion verification-key tree could be accepted, bypassing the allowlist and allowing arbitrary, potentially invalid executions to be certified, for example for onchain verification.
What the attacker needed
Ability to generate wrap and final proofs; control over the recursion vk tree
The fix
Add an explicit equality check in both final verifiers so the parsed vk_root must match the prover's trusted recursion_vk_root converted to the BN254 field representation.
How it was found
- Build a recursion Merkle tree containing unauthorised verification keys, such as circuits that omit critical constraints.
- Generate wrap and final PLONK or Groth16 proofs that reference the altered vk_root.
- Submit the proofs to the final verifier, which accepts them because it does not cross-check vk_root against the trusted root.
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 zero-knowledge proof system lets someone prove a computation was done correctly without showing all the steps. Here, the final check reads a value called the verification-key root from the proof itself and trusts it, instead of comparing it to the list of keys the system is supposed to accept. That means someone could swap in their own keys and still get a proof accepted.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.