# Malicious WASM program can cause denial of service attack against SEDA validators through unbounded stdout/stderr

SEDA's WASM VM lacked stdout/stderr size limits, letting a malicious data request write gigabytes of output and OOM validators during endblock tally.

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

**Target:** WASM VM runtime (runtime.rs) and tally endblock processing
**Root cause:** runtime.rs enforces MAX_VM_RESULT_SIZE_BYTES on execution results but not on stdout/stderr buffers, which are collected, copied across Rust/Go via CGO, and stored in tallyResults without bound.
**Steps:**
1. Write a WASM module that loops writing large chunks to stdout/stderr (up to u32/4GB per fd_write).
2. Submit it as a data request to the SEDA network with sufficient gas limit.
3. Validators execute it during tally in endblock.go, collecting unbounded output into TallyResult/DataResult.
4. Submit many such requests in the same batch to multiply memory pressure.
5. Observe validator memory exhaustion and OOM crashes.
**How found:** Code review comparing the existing MAX_VM_RESULT_SIZE_BYTES check on execution results against the absence of any equivalent limit on stdout/stderr buffers, then tracing the output through CGO into endblock tally storage.
**Exploitation:** Attacker submits multiple data requests referencing the same malicious WASM program so they are tallied in one endblock batch; each produces up to ~8GB stdout+stderr that is copied through Rust strings, Vec<String>, FFI, and Go structures, exhausting validator memory and crashing nodes.
**Escalation:** Submitting many requests to the same malicious program in a single batch amplifies memory pressure across all validators simultaneously.
**Insight:** When a codebase bounds one output channel (execution result) but not sibling channels (stdout/stderr), check every path where guest-controlled data crosses FFI into host memory; per-call limits like fd_write's u32 are not aggregate limits.

