Mitigate proof-deserialization DOS vector#1609
Draft
moodlezoup wants to merge 1 commit into
Draft
Conversation
Contributor
Benchmark comparison (crates) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a canonical, size-bounded decode boundary for
JoltProofinjolt-verifier, closing a deserialization DoS vector: a standalone proof arrives as untrusted bytes, and its many length-prefixedVecs (RA commitment vectors, per-round sumcheck vectors, BlindFold row/commitment vectors) previously had no systematic allocation ceiling — a malicious length prefix could drive an unbounded allocation. (The Dory round count was already capped element-locally byMAX_SERIALIZED_PROOF_ROUNDS; this is the outer bound covering everything else.)JoltProof::from_canonical_bytes/from_canonical_bytes_bounded(crates/jolt-verifier/src/decode.rs): rejects inputs overMAX_PROOF_BYTES(128 MiB) before allocating, caps allocation during decoding via bincode's read limit, and rejects trailing bytes after a complete proof so exactly one encoding is accepted (no proof malleability). Callers with a tighter bound from preprocessing can pass it;MAX_PROOF_BYTESremains the absolute ceiling.JoltProof::to_canonical_bytes: the matching encoder.VerifierErrorvariants:ProofTooLarge,TrailingProofBytes,ProofDeserializationFailed,ProofSerializationFailed.Element-level validation (curve points in-subgroup, field elements reduced) is unchanged — it's enforced by the field/group
serdeimpls routing throughCanonicalDeserializewith validation.Testing
crates/jolt-verifier/src/verifier.rs).core-fixturesintegration test round-trips a real Dorymuldivproof through the canonical encoding and checks size-cap, trailing-byte, and truncation rejections end to end (crates/jolt-verifier/tests/support/core_fixtures.rs).(DoryScheme, Pedersen<Bn254G1>)instantiation satisfies the requiredserdebounds.🤖 Generated with Claude Code