GHSA-3whf-vgf2-9w6g: zaino-state has a Non-Finalized State Reorg — No Cycle Detection or Depth Limit
NonFinalizedState::handle_reorg 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 previous_block_hash points back to itself (or forms a cycle with other blocks), causing handle_reorg 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.
References
- github.com/advisories/GHSA-3whf-vgf2-9w6g
- github.com/zingolabs/zaino/commit/428822509bc722eb9727681752686ede9bc87e77
- github.com/zingolabs/zaino/commit/d874295f1377bec7fd712ef75b364181b8c77d46
- github.com/zingolabs/zaino/commit/e05112aac54ec3cdb6da29fbc143ea710b32f009
- github.com/zingolabs/zaino/pull/1172
- github.com/zingolabs/zaino/security/advisories/GHSA-3whf-vgf2-9w6g
Code Behaviors & Features
Detect and mitigate GHSA-3whf-vgf2-9w6g with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →