Skip to content
DoS Audit finding Intermediate

Zero Config Values Can Crash or Stall the Prover Indefinitely

The prover's shard-splitting code trusts configuration values without checking for zero, so a zero threshold causes a panic or an infinite loop. An attacker who can influence the configuration, for example through environment variables or a large program, could crash or stall proof generation.

johnyfwesh Follow with mohamedfahmy

Originally disclosed on Code4rena

Submitted by johnyfwesh, also found by mohamedfahmy

crates/core/executor/src/record.rs #L201)

ExecutionRecord::split trusts SplitOpts values without guarding against zeros. The per-syscall divisor comes straight from the options (threshold = opts.syscall_threshold[syscall_code]) and is passed to events.chunks_exact(threshold) (crates/core/executor/src/record.rs:201). Rust panics on chunks_exact(0), so any zero threshold crashes the prover during shard generation.

When done == true, the same routine computes capacity = 2 * opts.page_prot and capacity = 2 * opts.memory inside loops that slice init_remaining/finalize_remaining by init_to_take and finalize_to_take (crates/core/executor/src/record.rs:250 and crates/core/executor/src/record.rs:314). If either capacity is zero, both counts stay at zero, the slices never shrink, and the loop spins forever while holding the deferred-record mutex—a CPU-burning DoS.

Nothing prevents these zeros from entering the function. SplitOpts::new divides the remaining trace area by various costs and then truncates to the nearest multiple of 32 via trunc_32 (crates/core/executor/src/opts.rs:83-145, crates/core/executor/src/utils.rs:111). Whenever the quotient drops below 32, the threshold collapses to zero. The only assertion checks available_trace_area >= fixed_trace_area, so reaching exactly zero slack—or any positive slack insufficient for a single chunk—is accepted.

Attackers do not need privileged configuration access:

  • PrecompileEvents::default seeds an entry for every should_send() syscall, even when the event list is empty. A zeroed threshold therefore triggers chunks_exact(0) immediately on the first shard (crates/core/executor/src/events/precompiles/mod.rs:246-279).
  • The public prover APIs propagate SP1CoreOpts straight from environment variables or user-supplied configs. A large-yet-valid ELF (≈23.6M instructions) already causes available_trace_area to fall below the minimum cost, yielding zero thresholds under default settings. Users can also set HEIGHT_THRESHOLD=1 or otherwise override the options to hit the same state.

Affected Code

// crates/core/executor/src/record.rs:188-360
for (syscall_code, events) in precompile_events.into_iter() {
    let threshold: usize = opts.syscall_threshold[syscall_code];

    let chunks = events.chunks_exact(threshold); // panic when threshold == 0
    …
}

let capacity = 2 * opts.page_prot; // zero ⇒ init_to_take == finalize_to_take == 0
let init_to_take = init_remaining.len().min(capacity);
let finalize_to_take = finalize_remaining.len().min(capacity - init_to_take);
…
init_remaining = &init_remaining[init_to_take..]; // never advances when both counts are 0

Impact

View detailed Proof of Concept

Recommended Mitigation

  • Enforce minimum values when constructing SplitOpts (e.g., clamp each threshold to at least 1, or wrap them in NonZeroUsize and surface configuration errors early).
  • Add defensive assertions in ExecutionRecord::split to fail fast if a zero sneaks through, ensuring future regressions are caught during testing.
  • Consider distributing trace area using usize::max(value, 1) (or similar) instead of hard truncation via trunc_32.
  • Cover these invariants with unit tests that instantiate SplitOpts near the boundary conditions.

References


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

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

How it worked

Root cause

Likely the code does not validate that configuration values used as divisors or loop capacities are greater than zero before using them.

Impact

A zero threshold causes a deterministic panic or an infinite loop that holds a mutex, stalling the prover; the text says attackers can reach this through unvalidated environment variables or large programs.

What the attacker needed

Ability to influence prover configuration; or a large program that reduces trace area

The fix

The report recommends enforcing minimum values when constructing `SplitOpts`, adding defensive assertions in `ExecutionRecord::split`, and covering boundary conditions with unit tests.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

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

A prover is a program that creates cryptographic proofs. It splits its work into chunks, and the chunk size comes from settings. If a setting is zero, the code either crashes or gets stuck in a loop that never finishes, so the proof never gets made.

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 johnyfwesh

View all

8 more disclosed reports, best first.

More from Succinct

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.