Secrypta Crypto security lab
RU / EN
Release Project: drain-scan·open-source · MIT 22 November 2026·3 min read

drain-scan: a wallet-drain detector that stays silent instead of guessing

Abstract

We published drain-scan, an open-source (MIT) static detector for wallet-drain classes in smart-wallet code. Its defining property is precision: zero false positives across all 155 labeled fixtures of the public corpus.

What it catches

drain-scan reads contract sources and looks for on-chain drain surfaces: unbounded approvals, operator grants, blind-sign via ERC-1271, controlled delegatecall, AA/EIP-7702 forwarders and init-hijack. Targets are smart wallets, ERC-4337, EIP-7702 and multisigs.

  • 15 rules (R1-R15).
  • Its own engine over the solc AST, no Slither, plus a Semgrep layer.

How it was validated

Validation runs on the public labeled wallet-harness corpus.

  • Precision 1.000: 0 false positives across all 155 fixtures.
  • It also holds on a 94-case split added after the first release (not a blind holdout: some rules were written while these cases were visible): 41 vulnerable, 53 safe.

The honest boundary

drain-scan is precision-first by design. Recall is deliberately narrow: 0.450 on that 94-case split (F1 0.621), below general tools on this corpus. It only fires where it is confident. Off-chain and UX vectors (address poisoning, fake airdrops) are out of scope.

wallet-harness: 155 executable reproductions; each label is confirmed by running its reproduction (a corpus self-check, not a detector score).

What it is and isn't

A tool for developers and auditors: a fast static pass without false alarms. It does not replace execution-based checks (wallet-harness) and does not catch everything.

quickstart
# one-time setup: a venv with solc and semgrep (no Slither)
python3 -m venv .venv && . .venv/bin/activate && pip install -r requirements.txt
solc-select install 0.8.24 && solc-select use 0.8.24
# scan a contract (a .sol file or a directory)
./scan path/to/Wallet.sol