# `call_result_write` import can be exploited for unmetered execution and memory growth

Seda's call_result_write WASM import skipped gas metering, letting a malicious Tally program loop or request huge writes to exhaust validator CPU/memory and halt the chain.

- 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/248
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-12-seda-protocol%3AH-14
- Tags: area:web3 domain:oss domain:web3 impact:dos kind:contest platform:sherlock sev:high tech:rust technique:source-review vuln:dos vuln:misconfiguration

**Target:** seda-wasm-vm core Tally WASM import (call_result_write)
**Root cause:** The call_result_write host import never calls apply_gas_cost, unlike sibling imports, so writes and loops through it are free of metering.
**Steps:**
1. Write a WASM Tally program that loops calling call_result_write while gas remains, or passes result_data_length near 100GB.
2. Compile and deploy via StoreOracleProgram() in x/wasm-storage.
3. Post a Data Request that executes the malicious Tally program.
4. During tally, EndBlock() executes the program; unmetered loop/write drains validator CPU/memory, causing delays or OOM chain halt.
**How found:** Code review comparing call_result_write against other core Tally imports (e.g. execution_result) revealed the missing apply_gas_cost call.
**Exploitation:** Attacker pays only loop gas, deploys malicious Tally WASM, triggers it via a Data Request; the unmetered import lets execution/memory grow unbounded, crashing or stalling all validators running tally in EndBlock.
**Escalation:** Setting result_data_length to ~100GB turns resource drain into validator OOM and potential chain halt.
**Insight:** When auditing WASM/VM host imports, diff every import against its siblings for metering calls; a single import missing apply_gas_cost is a free resource-exhaustion primitive reachable from user-deployed code.

