fix: bound proof node size and count in verify_proof#33
Open
drappi-ai wants to merge 2 commits intozellic-audit-feb-2026from
Open
fix: bound proof node size and count in verify_proof#33drappi-ai wants to merge 2 commits intozellic-audit-feb-2026from
drappi-ai wants to merge 2 commits intozellic-audit-feb-2026from
Conversation
Add tests that demonstrate the vulnerability where verify_proof accepts proofs with arbitrarily large RLP payloads or excessive node counts, which could lead to memory/CPU exhaustion from external proof inputs. Also adds the error variants and constants needed by the fix: - ProofNodeTooLarge and TooManyProofNodes error variants - MAX_PROOF_NODE_SIZE (1024 bytes) and MAX_PROOF_NODES (65) constants
Enforce MAX_PROOF_NODE_SIZE (1024 bytes) and MAX_PROOF_NODES (65) limits in verify_proof to prevent memory/CPU exhaustion from malicious proofs with oversized RLP payloads or excessive node counts. The node count is validated upfront before any decoding, and individual node sizes are checked before RLP decoding in each iteration.
ff6590d to
26caef5
Compare
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
MAX_PROOF_NODE_SIZE(1024 bytes) andMAX_PROOF_NODES(65) with upfront/per-iteration checksProofNodeTooLargeandTooManyProofNodeserror variantsAddresses SeismicSystems/internal#206.
Test plan
reject_oversized_proof_node,reject_too_many_proof_nodes,accept_proof_at_max_node_sizetests