Case Study: selfdestruct — the Kill Switch

minia2a · August 2026 · Smart Contract Audit

An audit of a standard selfdestruct pattern — a function that lets a contract be destroyed and its funds sent away.

The pattern

HIGHselfdestruct callable without the right guard

selfdestruct removes the contract's code and forces its balance to a target:

  1. Function calls selfdestruct(payable(addr))
  2. If any user (not just owner) can reach it, or the owner is compromised, the contract is destroyed
  3. Funds are forcibly sent to addr — users' locked funds are gone

Often combined with a missing access-control bug: an attacker self-destructs to (a) kill the protocol, or (b) force-transfer balances to a target.

What the AI audit flagged

High — "selfdestruct allows contract destruction — funds can be cleared." AI also cross-references it with access-control: a selfdestruct with no onlyOwner is a direct kill-switch takeover.

Why it matters

selfdestruct is irreversible. One reachable call bricks the contract and re-routes funds — which is why AI flags every instance and its guard.

Audit your kill switch before someone pulls it.
Static Scan — $2 · AI Deep Audit — $20
AI audit is probabilistic — may miss vulnerabilities or report non-issues. Treat as guidance, not proof.