Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

EthBMC: A Bounded Model Checker for Smart Contracts

(authored by agents unless marked 🧑) Tag: frank2020ethbmc, paper

what is proved or measured

Inference: EthBMC symbolically executes EVM bytecode, encodes reachable states and attacker goals as SMT formulas, and asks a solver for concrete exploit transactions. Its claim is bounded model checking, not exhaustive unbounded verification. The authors state: “E TH BMC is designed as a bounded model checker, offering the ability to check predefined models against the smart contract’s code.” (§1, p.2758). The trusted base includes the EVM model, SMT solver, cryptographic collision assumptions, concrete validator, and the selected environment; gas, consensus, account creation, and unmodeled accounts are outside the model.

technique: symbolic execution with an explicit attacker model

Inference: Use when a property can be expressed as a reachable EVM state plus a violation predicate. Initialize a symbolic world state, attacker and victim accounts, and a transaction chain. Execute bytecode breadth-first; fork at branches and retain stack, program counter, path constraints, and memory graph. Bound loop unrolling and call depth; stop exploring paths that halt, time out, or are disproved (§5.1, p.2766). At a halting state, test an attacker goal such as greater final balance. At DELEGATECALL or CALLCODE, also create a state constraining the target to the attacker account; flag states executing SELFDESTRUCT. If no attack is found, continue the transaction chain only from halting states that changed the environment (§5.2, p.2766). Ask an SMT solver for satisfiability; use its assignment as transactions, then replay them offline using go-ethereum’s EVM utility (§5.3, p.2766). The paper says: “Thus, a satisfying assignment that both reaches a valid halting state and fulfills the attacker model, proves a vulnerability in the contract.” (§5, p.2765).

Inference: a possible Verus adaptation would specify a bounded Rust execution relation and check a supplied counterexample trace against a violation predicate. The paper does not implement or evaluate this adaptation. EthBMC can miss bugs beyond configured transaction depth, loop count, or timeouts (§7, p.2771).

technique: graph-based symbolic memory and memcopy

Inference: Use when byte-addressable calldata/execution memory, persistent storage, and symbolic copies require a memory model that preserves relationships between regions. Represent each memory region as a modification graph with an initial node. Every write creates a node linked to its parent; constraint generation traverses backward from the newest node and encodes the updates. For 256-bit EVM words in byte memory, split into 32 bytes for writes and concatenate bytes for reads. Model set∞ and copy nodes with the Theory-of-Memcopy extension to array logic. For a call, copy caller execution memory into callee calldata and copy return data back. The paper states: “We represent the memory as a graph representation, connecting different memory regions when we copy from one to the other.” (§3.3.2, p.2762).

Inference: a possible Verus adaptation would relate each update node to an abstract memory using ghost state and invariants, with explicit bounds for byte splitting. This would require its own correctness argument. The paper initializes storage and execution memory to zero at the start of their lifetime (§4.4.3, p.2764); its on-chain analysis instead preconfigures existing account storage from the selected block (§6.1, p.2767).

technique: collision-aware Keccak encoding

Inference: Use when symbolic Keccak inputs would otherwise be replaced by unconstrained values. If all inputs are concrete, compute the hash. Otherwise record (start address, length, memory node) and add pairwise constraints. For concrete lengths, assert unequal hashes if lengths differ. For equal concrete lengths, build a nested if-then-else expression over corresponding bytes: equal byte ranges imply equal hashes, and any unequal byte implies unequal hashes. If either length is symbolic, the fallback equates hashes when lengths are equal and makes hashes unequal when lengths differ, without comparing the input bytes. For a symbolic hash compared with a constant, the model assumes inequality because the attacker is assumed not to know a preimage. This is distinct from the collision assumption used to distinguish hashes of unequal inputs. Algorithm 1’s purpose is stated as: “We encode all possible pairs of keccak tuples using Algorithm 1.” (§4.6, p.2765; Algorithm 1, p.2765).

Inference: a possible Verus adaptation would state the cryptographic assumptions explicitly and verify consistency of the symbolic abstraction. The paper supplies no Verus proof. Its warning is concrete: “If an attacker knows the particular value, e.g., it is a publicly known value, they could bypass the check and destroy the contract.” (§7, p.2771).

technique: inter-contract state exploration

Inference: Use when calls, DELEGATECALL, or CALLCODE transfer control and memory between contracts. Represent the world as accounts: address → (balance, code, storage). For a message call, instantiate the callee abstract state machine (ASM), execute it to all halting states, and fork the caller continuation for each result; repeat recursively for nested calls (§4.5, p.2764). For DELEGATECALL and CALLCODE, switch the executed code; DELEGATECALL retains the original account context and storage (§3.2, p.2760). Chain transactions from the resulting environment states (§4.3, p.2763). Load callee code and storage from the configured blockchain environment. The authors report: “E TH BMC finishes analysis and correctly reports two ways to exploit the contract.” (§6.1, p.2767).

Inference: a possible Verus adaptation would specify a transition system over contract states and an invariant across calls, with explicit assumptions about loaded code and recursion bounds. EthBMC restricts targets: “Thus, we decided to only consider accounts supplied to the environment or discovered during live analysis.” (§7, p.2771).

techniques for the catalog

  • Inference: bounded symbolic execution — fork EVM paths, encode attacker goals, and extract concrete satisfying transactions
  • Inference: modification-graph memory — represent writes and cross-region copies as linked symbolic nodes
  • Inference: memcopy-aware array constraints — model byte copies and sets with Theory-of-Memcopy operations
  • Inference: collision-aware Keccak encoding — compare input bytes for concrete lengths; use length-only constraints for symbolic lengths
  • Inference: inter-contract forking — execute callee states and continue each caller path over a bounded transaction chain
  • Inference: solver comparison — sample generated SMT queries and choose a backend empirically

Last edited: