# zkTrie maximum depth limit is not enforced in Scroll

ScrollVerifierHooks.walkTree omits Scroll's 248-bit zkTrie depth limit, letting proofs deeper than spec be accepted, breaking verifier soundness assumptions.

- Payout: Contest reward
- Severity: medium
- Program: Unruggable
- Credited: Evo
- Disclosed: 2025-02-24
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2024-12-unruggable-invitational#m-01
- Library page: https://bugbountylibrary.com/r/c4%3A2024-12-unruggable-invitational%3AM-01
- Tags: domain:web3 impact:integrity kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:crypto vuln:misconfiguration

**Target:** ScrollVerifierHooks.sol walkTree proof verification
**Root cause:** The walkTree loop iterates over proof nodes without enforcing Scroll's documented 248-bit maximum zkTrie depth, so proofs deeper than the spec are accepted.
**Steps:**
1. Read Scroll zkTrie docs: max depth 248, only lower 248 bits of key traversed.
2. Compare Scroll's own walkTree which enforces the depth check.
3. Inspect Unruggable ScrollVerifierHooks.walkTree loop: no `if (i >= 248) revert` guard.
4. Craft a proof with >248 levels; verifier accepts it despite spec violation.
**How found:** Code review comparing Unruggable's walkTree against Scroll's official zkTrie documentation and reference implementation, spotting the missing depth guard in the loop.
**Insight:** When reimplementing a verifier for another protocol's data structure, diff your loop bounds and invariants against the upstream reference implementation and its spec docs—missing depth/iteration caps are easy to overlook and break soundness assumptions.
