Skip to content

fix: bound proof node size and count in verify_proof#33

Open
drappi-ai wants to merge 2 commits intozellic-audit-feb-2026from
cdai__fix-206-unbounded-rlp
Open

fix: bound proof node size and count in verify_proof#33
drappi-ai wants to merge 2 commits intozellic-audit-feb-2026from
cdai__fix-206-unbounded-rlp

Conversation

@drappi-ai
Copy link

Summary

  • Proof nodes were decoded without size or count limits, allowing memory/CPU exhaustion via malicious proofs
  • Added MAX_PROOF_NODE_SIZE (1024 bytes) and MAX_PROOF_NODES (65) with upfront/per-iteration checks
  • Added ProofNodeTooLarge and TooManyProofNodes error variants

Addresses SeismicSystems/internal#206.

Test plan

  • reject_oversized_proof_node, reject_too_many_proof_nodes, accept_proof_at_max_node_size tests
  • All existing tests pass

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.
@drappi-ai drappi-ai force-pushed the cdai__fix-206-unbounded-rlp branch from ff6590d to 26caef5 Compare March 9, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant