Skip to content
DoS Audit finding Intermediate

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

g Follow with tallo

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/248

Found by

g, tallo

Summary

Unlike the other core Tally imports, call_result_write does not call apply_gas_cost to charge the caller gas. Any attacker can exploit this issue to do unmetered execution or memory growth because there is no cost to the attacker. This impacts validators by draining their resources, whether CPU or memory, and can lead to chain delays or Chain Halts, in the worst case.

Root Cause

In the call_result_write import, there is no call to apply_gas_cost unlike in the other imports.

Rust
fn call_result_value(
    env: FunctionEnvMut<'_, VmContext>,
    result_data_ptr: WasmPtr<u8>,
    result_data_length: u32,
) -> Result<()> {
    // @audit apply_gas_cost() must be called at the start to apply metering
    let ctx = env.data();
    let memory = ctx.memory_view(&env);

    let target = result_data_ptr.slice(&memory, result_data_length)?;
    let call_value = ctx.call_result_value.read();

    for index in 0..result_data_length {
        target.index(index as u64).write(call_value[index as usize])?;
    }

    Ok(())
}

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

  1. The Attacker creates a WASM program that exploits the unmetered execution of call_result_write.

The program can either loop for as long as there is gas available (they only need to pay for the gas for the loop) or set result_data_length to 100GB in length. 2. The Attacker then compiles the WASM program and deploys the binary via StoreOracleProgram(). 3. The Attacker posts a Data Request that will execute their earlier deployed Tally Program. 4. Once the Data Request is for tallying, it will be processed in the Tally module's EndBlock(). 5. When executing the Attacker's Tally Program, it either crashes all the validators that run it due to Out-of-Memory and cause a chain halt, or the unmetered execution delays block building significantly.

Impact

Unmetered execution or memory growth will drain the resources of Validators, leading to chain delays or chain halts.

PoC

None

Mitigation

Consider calling apply_gas_cost in the call_result_write import to apply metering.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/sedaprotocol/seda-wasm-vm/pull/67

The original report as published on Sherlock, by g. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity doS bug in SEDA Protocol. Sherlock made it public on 20 March 2025. Found in the 729 audit contest (finding H-14), also found by 1 other warden.

About DoS

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by g

View all

23 more disclosed reports, best first.

More from SEDA Protocol

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.