[pallets/weaver] Unbounded mint via distinct out-of-bounds slot_index values: one empty leaf mints without limit (latent; currently unreachable)

Component: ghost-node @ 0162da46, pallets/weaver/src/types.rs (get_preimage_slice, get_unique_key).

Latency caveat (read first): this path is currently NOT reachable end to end. Round-1 finding W3 established that pull_thread is not whitelisted in validate_unsigned, so dispatch cannot reach it today. Everything below is verified at the pallet level; it becomes live the moment the unsigned gating is fixed, at which point the severity below applies in full.

Description: atla #109 capped the impact at 255 pulls per tree, assuming one empty leaf. The replay/claim key binds the raw u64 slot_index, so every distinct out-of-bounds value (8, 9, …, u64::MAX) yields a fresh key for the same empty leaf: one empty leaf mints unboundedly, not 255 times. The None arm of slot_values.get_mut(slot_index_usize) degrades the out-of-bounds leaf to the protocol’s empty-leaf padding, so each fresh key verifies against the anchored root. This is a distinct, strictly larger impact than #109 itself, not a re-report. (Note: the devs’ internal fix for #109, commit 77bf441, is absent from the audited repo history; it should be checked against this variant, not assumed to close it.)

Impact: Unbounded arbitrary mint per empty leaf once the claim path is reachable. Currently latent behind W3; becomes Critical-class the moment the unsigned gating is fixed.

Reproduction: PoC in pallets/weaver/src/poc_r2.rs (7/7 pass; full ghost-weaver suite 34/34, no regressions): 3 pulls with distinct out-of-bounds slot indexes, 3 x 1,000,000 minted against the anchored root.

Severity: High (latent Critical). Reason: the primitive is an unbounded mint; High rather than Critical today solely because end-to-end exploitation is gated behind W3.

Recommendation: Bound slot_index to the provisioned slot range at the validation layer (reject, do not fail open), and bind the claim key to the canonical leaf preimage rather than the raw index. Re-check whether internal fix 77bf441 closes this variant or only the single-leaf case.

Verification: VERIFIED (executed pallet-level PoC).

Hi team

Noting for the record that this same root cause was reported earlier as topic 88 on 2 October, with an executed pallet-level PoC: out-of-bounds slot_index degrades to the empty-leaf padding in get_preimage_slice, and distinct out-of-bounds values yield distinct claim keys in get_unique_key, so one empty leaf mints without bound. The PoC there minted with slot_index 999 and again with 1000 against the same anchored root. The validate_unsigned reachability caveat was filed with it as the companion finding in the same topic.

Shahmeer

Thank you for your report!

@Rusdiwireng and @Sands - could you confirm whether the issue is still active after this commit and this one, or whether it persists in any case?

For historical context, here is the earlier post about a similar issue.

Hi team. I ran the exact attack from this report against a local checkout with both commits applied: pulls with distinct out-of-bounds slot_index values (8, 999, 1000, u64::MAX) against an anchored root containing the empty leaf are all rejected with InvalidMerkleProof at the proof layer, and the unsigned pool gate now rejects the same proof with BadProof. The honest in-bounds pull still mints, so the fix does not break the real path. The issue is closed by 77bf441 at the verification layer and does not persist in any case after d8bfe2a, with one note: d8bfe2a opens the unsigned path that was previously closed, so the ordering here matters, 77bf441 had to land first. Shahmeer