Proof nonce clobbered when packing deferred page protection events into last shard
When execution finishes and deferred page-protection events are packed into the already-produced last CPU shard, the code overwrites that shard's proof nonce with the deferred accumulator's nonce, which is still the default zero value. This makes the final shard's nonce differ from earlier shards, so valid executions fail verification.
Originally disclosed on Code4rena
Submitted by mohamedfahmy
crates/core/executor/src/record.rs#L288-L291crates/core/machine/src/executor.rs#L300-L309crates/prover/src/verify.rs#L223-L237
When finishing execution and packing deferred page protection (page*prot) events into the already-produced last CPU shard, the code overwrites the last shard’s public*values.proof*noncewith the deferred accumulator's nonce. Because the deferred accumulator is initialized with default public values and never populated with the real proving nonce, itsproof*nonceremains[0; 4]. This clobbers the correct nonce set on CPU shards and causes a mismatch across shards.
Overwrite site: crates/core/executor/src/record.rs in ExecutionRecord::split (around line 289) assigns: last_record_ref.public_values.proof_nonce = self.public_values.proof_nonce;
Deferred accumulator creation (nonce stays default): crates/core/machine/src/executor.rs constructs ExecutionRecord::new(program.clone()) for deferred and never sets its public_values.proof_nonce.
Verifier check: crates/prover/src/verify.rs requires all shards to have identical proof_nonce.
This path is reached when execution is done (done == true), no precompile shards were emitted (so the memory/page*prot events can be packed into last*record) and the deferred sets are below packing thresholds.
Impact
Valid executions that end with a small batch of deferred page-prot events fail verification because the final shard’s nonce becomes [0;4] while earlier shards retain the real nonce.
Breaks the entire proof for affected runs.
Does not enable acceptance of invalid proofs it only causes valid proofs to be rejected.
View detailed Proof of Concept
Recommendation
Do not overwrite the nonce when packing into an existing last shard.
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 packing step assigns the deferred accumulator's default-initialised proof nonce onto the existing last shard instead of preserving the shard's real nonce.
Impact
Valid executions ending with a small batch of deferred page-protection events fail verification, breaking the entire proof for affected runs; it does not allow invalid proofs to be accepted.
What the attacker needed
Execution finishes with done == true; no precompile shards emitted; deferred sets below packing thresholds
The fix
The nonce should not be overwritten when packing deferred events into an existing last shard.
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 proof is split into several shards, and each shard carries a small tag called a nonce that must match across all shards. Here, when the last shard was finished, the code replaced its correct tag with a default zero tag, so the verifier saw mismatched tags and rejected an otherwise valid proof.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.