Skip to content
DoS Audit finding Beginner

Public verifier API panics on malformed inputs, enabling DoS

The public PLONK proof verification function unwraps fallible decoding of the verifying key, proof and public inputs, so malformed bytes cause a panic. An attacker who can submit proof data to a service using this function could crash the whole process and repeat it to keep the service offline.

valarislife Follow

Originally disclosed on Code4rena

Submitted by valarislife

The PlonkVerifier::verify_gnark_proof function unwraps fallible decoding operations for the PLONK verifying key, proof, and public inputs without proper error handling. When malformed inputs are provided, these .unwrap() calls cause the program to panic, enabling a denial-of-service (DoS) attack.

Affected code (lines 120-129 in crates/verifier/src/plonk/mod.rs):

pub fn verify_gnark_proof(
    proof: &[u8],
    public_inputs: &[[u8; 32]],
    plonk_vk: &[u8],
) -> Result<(), PlonkError> {
    let plonk_vk = load_plonk_verifying_key_from_bytes(plonk_vk).unwrap(); // ⚠️ panic on malformed VK
    let proof = load_plonk_proof_from_bytes(proof, plonk_vk.qcp.len()).unwrap(); // ⚠️ panic on malformed proof

    let public_inputs =
        public_inputs.iter().map(|input| Fr::from_slice(input).unwrap()).collect::<Vec<_>>(); // ⚠️ panic on malformed input
    verify_plonk_algebraic(&plonk_vk, &proof, &public_inputs)
}

Similar patterns exist in crates/verifier/src/converter.rs when parsing compressed points.

Impact:

  1. Denial of Service: Any service or application that forwards user-supplied proof/VK bytes to verify_gnark_proof can be crashed by malformed inputs.
  2. Repeated attacks: Malicious actors can repeatedly submit invalid inputs to maintain persistent DoS.
  3. Process termination: The panic terminates the entire process, not just the verification operation.
  4. Public API exposure: This is a public API function that may be called from web services, APIs, or other untrusted contexts.

Exploit scenario:

An attacker identifies a web service that accepts ZK proofs for verification. The service uses PlonkVerifier::verify_gnark_proof to validate submissions. The attacker submits:

  • A truncated or malformed verifying key (e.g., only 3 bytes instead of expected size)
  • Invalid proof bytes
  • Malformed public input arrays

The service panics and crashes. By repeatedly sending malformed inputs, the attacker can keep the service offline, preventing legitimate users from verifying valid proofs.

Recommended mitigation steps

  1. Replace all .unwrap() calls with proper error propagation:

    pub fn verify_gnark_proof(
       proof: &[u8],
       public_inputs: &[[u8; 32]],
       plonk_vk: &[u8],
    ) -> Result<(), PlonkError> {
       let plonk_vk = load_plonk_verifying_key_from_bytes(plonk_vk)
           .map_err(|_| PlonkError::InvalidVerifyingKey)?;
       let proof = load_plonk_proof_from_bytes(proof, plonk_vk.qcp.len())
           .map_err(|_| PlonkError::InvalidProof)?;
    
       let public_inputs: Result<Vec<_>, _> = public_inputs
           .iter()
           .map(|input| Fr::from_slice(input))
           .collect();
       let public_inputs = public_inputs
           .map_err(|_| PlonkError::InvalidPublicInput)?;
    
       verify_plonk_algebraic(&plonk_vk, &proof, &public_inputs)
    }
    
  2. Validate input lengths and structure before attempting to parse.

  3. Add fuzzing tests for proof/VK decoders in CI to catch similar issues.

  4. Document expected input formats and size constraints in the API documentation.

  5. Add error variants to PlonkError enum:

    pub enum PlonkError {
       // existing variants...
       InvalidVerifyingKey,
       InvalidProof,
       InvalidPublicInput,
    }
    

View detailed Proof of Concept


The original report as published on Code4rena, by valarislife. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 decoding functions return a Result, but the code calls .unwrap() on them, turning a recoverable parse error into a panic.

Impact

A service that forwards untrusted proof or key bytes to this function could be crashed, and repeated submissions could keep it offline for legitimate users.

What the attacker needed

Service accepts untrusted proof bytes; attacker can reach that service

The fix

The unwraps should be replaced with error propagation that maps decode failures to new PlonkError variants, with input validation and fuzzing added.

How it was found

  1. Find a service that passes user-supplied proof or verifying key bytes to the public verification function.
  2. Submit a truncated or malformed verifying key, invalid proof bytes, or malformed public inputs.
  3. The decoding unwrap panics and the process terminates.
  4. Repeat the malformed submissions to keep the service down.

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 whether a zero-knowledge proof is valid. Here the code assumed the incoming data would always be well formed, so when it was not, the program crashed instead of returning an error. Anyone allowed to send proof data could therefore knock the service over by sending rubbish.

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.

More from Succinct

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.