Medium, CVSS 6.9crates.ioAmendedPublished
zaino-state has a Non-Finalized State Reorg — No Cycle Detection or Depth Limit
GHSA-3whf-vgf2-9w6g
- Affected
- crates.io zaino-state < 0.4.1
- Fixed in
- 0.4.1· Vendor fix available
- Issue
- NonFinalizedState::handlereorg is a recursive, unbounded async function that traverses parent blocks until it finds a common ancestor on the main chain. It has no recursion depth limit and no cycle detection. A malicious or buggy validator can serve a block whose previousblockhash points back to itself (or forms a cycle with other blocks), causing handlereorg to infinite-loop, consuming 100% CPU and never making sync progress. Additionally, update() contains an .expect("empty snapshot impossible") that panics if the non-finalized snapshot becomes empty after trimming finalized blocks. Details Location: packages/zaino-state/src/chainindex/nonfinalisedstate.rs:443-489 Infinite loop via self-referencing block: 1. A compromised validator serves a block B where B.prevhash == B.hash. 2. handlereorg is called with B. 3. getblockbyhashbytesinserializedorder(B.prevhash) finds B itself in workingsnapshot.blocks. 4. Check: is B.hash in workingsnapshot.heightstohashes? If B is a new…
Recommended action: Upgrade to 0.4.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.