# Anyone can pass any length to some Tally imports to inflate memory, induce OOM, and crash validators

Tally WASM import secp256k1_verify lacks length limits, letting a program request u32::MAX buffers and inflate validator memory ~12GB to OOM-crash nodes.

- Payout: Audit contest
- Severity: high
- Program: Seda Protocol
- Found by: g
- Disclosed: 2024-12-20
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/250
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-12-seda-protocol%3AH-16
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:high tech:evm tech:rust technique:source-review vuln:dos

**Target:** WASM VM Tally imports (secp256k1_verify, keccak256, execution_result)
**Root cause:** Tally import functions pass attacker-controlled length parameters directly to WasmPtr::slice/read_to_vec without bounds checks, and gas cost scales too cheaply relative to allocated bytes.
**Steps:**
1. Write a WASM Tally program importing `secp256k1_verify` from `seda_v1`.
2. Call it with `message_length = u32::MAX as i64`, `signature_length = -1i32`, `public_key_length = -1i32` (cast to u32 = max).
3. Compile and deploy via `StoreOracleProgram()`.
4. Post a Data Request that executes the deployed Tally Program.
5. During Tally `EndBlock()`, the import allocates ~4.3GB per buffer (~12GB total), OOM-crashing validators.
**How found:** Code review of Tally import implementations noticed length params passed unchecked to slice/read_to_vec, then computed max-u32 allocation (~12GB) versus the metered gas cost to confirm cheapness.
**Exploitation:** Attacker deploys a malicious Tally WASM and triggers it via a Data Request; during EndBlock tallying each validator allocates ~12GB, crashing nodes and potentially halting the chain. Gas cost (~4.3e13, negligible in SEDA) does not deter the attack.
**Insight:** In WASM/VM host imports, audit every length parameter passed to memory slice/read helpers; compare worst-case allocation against the gas/price charged to find cheap OOM vectors.

