Most "smart contract audit checklist" posts are a list of vulnerabilities someone else already found. They are useless in the first twenty minutes of a review, because you are not looking for vulnerabilities yet — you are trying to build a map of where the money is and who is allowed to move it. This is the sequence I run when a contract lands in front of me and I have twenty minutes before I have to decide whether it deserves a week. It is ordered by yield per minute, not by taxonomy. Two of the steps below are the ones that paid for themselves: the state-key inventory and the deployed-artifact check. Minute 0–3: Verify you are reading the code that is actually deployed Before a single line of logic: is the source in front of me the bytecode on chain? # 1. What is at the address? cast code $ADDR --rpc-url $RPC | head -c 200 # 2. Is it a proxy? EIP-1967 implementation slot cast storage $ADDR 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc --rpc-url $RPC # 3. If it is a proxy, repeat on the implementation, and read the admin slot too cast storage $ADDR 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103 --rpc-url $RPC # 4. Does the verified source match the runtime bytecode? # (compare the metadata hash appended by solc, or diff the compiled artifact) forge verify-check $GUID --chain $CHAIN Three things bite here and none of them are in the Solidity file: The repo is not the deployment. The commit that produced the live bytecode is often older than main. Bridges and AAs that instantiate from a factory hardcode a program hash; compute it yourself and compare. I have a case where the whole finding rested on chash160(source) == $base_aa matching a constant in the factory — without that, the report is about a file nobody runs. Constructor arguments are not in the source. Read them from the deployment transaction. A mis-set owner or a zero-address oracle in the constructor is a critical finding that never appears in a code review. Proxy admin powers. If the admin is an EOA, every "the owner cannot rug" comment in the README is fiction. Write down: address, implementation, admin, upgrade mechanism, and whether the upgrade path has a timelock. Three minutes, and it frames everything after. Minute 3–6: Draw the money map Do not read the code top to bottom. Answer four questions and draw them: Where does value enter? deposit, stake, lock, mint, bridge, receive. Where does it leave? withdraw, redeem, unstake, claim, release, sweep. Who can move it without depositing? owner, governance, keeper, operator, anyone via a public function. What accounting variable is supposed to equal the balance? totalAssets, totalSupply × price, reserve, a per-user credit ledger. grep -nE "function .*(deposit|withdraw|redeem|claim|stake|unstake|mint|burn|sweep|rescue)" src/*.sol grep -nE "transfer\\(|transferFrom\\(|safeTransfer|call\\{value" src/*.sol If the answer to (4) can be changed by someone who did not deposit — a donation, a rebase, a fee sent directly to the contract — the accounting is manipulable. That single check is the root of the entire share-inflation family. The map also tells you which 200 lines matter. In a 20,000-line repo you will spend your twenty minutes in maybe four functions, and the map is how you find them. Minute 6–9: Inventory the state keys This is the step most reviewers skip, and it is where the highest-severity bugs live in non-EVM systems and in EVM contracts that emulate mappings with hashes. List every storage key the contract writes, and for each one ask: what is the uniqueness domain of this key, and who controls each component? Patterns to hunt: grep -nE "keccak256\\(abi.encode" src/*.sol grep -nE "already|claimed|used|processed|executed|nonce|consumed" src/*.sol For each hit, classify every field that goes into the hash: Field: Immutable? — Attested? — Chosen by caller? txid: yes — — — no amount: yes — — — no timestamp: no — maybe — yes recipient: no — no — yes reward: no — no — yes Any row with a check in the last column that appears in a uniqueness key is a replay bug waiting to be written up. The canonical failure is a claim guard keyed on sha256(sender, txid, amount, timestamp, recipient, reward, data): seven inputs, four of them free, so the same transfer can be claimed once per distinct combination. The fix is always the same shape: key on the minimum immutable identity, validate the rest against it, and add a global invariant that total payouts per identity never exceed the attested amount. If the contract has shares, lpTokens, or any "amount × total / supply" formula, this is where you look next. In order: shares = amount * totalSupply / totalAssets; // rounding down, no zero check Rounding direction. Deposits must round down, withdrawals must round down in the protocol's favour. A single reversed division is a slow drain. Zero-share deposits. require(shares > 0) — if it is missing, a deposit can be accepted and credited with nothing. First-depositor / donation inflation. Attacker mints 1 wei of shares, donates a large amount directly to the contract, then a victim's deposit rounds to zero shares. Mitigation is virtual shares (_decimalsOffset), dead shares, or pricing that ignores unsolicited balance. Decimals. Mixing 6- and 18-decimal assets without normalization is a 10^12 error, and it usually lands in a cap or a fee, not in a revert. Oracle sanity. Is the price spot? Is it a TWAP with a window shorter than the manipulation cost? Is updatedAt checked for staleness? Does the code handle a revert from the oracle, or does it brick the pool? None of this needs the whole codebase. It needs the four functions from the money map. Minute 12–15: Access control, pause, and the queue Three quick passes: Access control. Every onlyOwner / onlyRole / require(msg.sender == ...) — list what it can do. The dangerous ones are setFee, setOracle, setLimit, upgradeTo, sweep, pause, and anything that changes who is allowed to withdraw. If an owner can set a fee to 100%, the protocol's real risk model is "trust the owner", and the report should say so plainly rather than pretending it is decentralised. Pause and liveness. Can withdrawals be stopped? By whom, for how long, and is there a user exit that bypasses the pause? "Temporary freezing of funds" is a legitimate Medium on most programs, and a pause with no exit is a finding, not a feature. Loops over user-controlled arrays. This is the quiet killer: for (uint i = 0; i available) break; // stop at the first unaffordable request _pay(pending[i]); } If the loop breaks on the first request it cannot afford, a single large request at the head of the queue blocks every request behind it — including ones that would fit. In a live pool I looked at, the head request was roughly ten times the pool's free balance and the next request was larger still; the loop exited immediately and 12.6 ETH of queued withdrawals sat unpaid behind a 0.5 ETH balance. No cancel function, no partial fill, no reordering. One depositor can grief the entire exit queue for the price of one transaction. The fix is continue with a running balance, or partial fills, plus a cancel path. If you see break inside a user-ordered queue, that is your finding — you can stop looking. Minute 15–18: External calls and token assumptions Reentrancy. State updated before the external call? Any callback into user code (onERC721Received, ERC-777 tokensToSend, a hook, a native transfer to a contract)? Read-only reentrancy counts: a view used by a third party while your state is mid-update is exploitable even if your own function is nonReentrant. Token quirks. Fee-on-transfer (received ≠ sent), rebasing balances, missing return values, approve race, USDT-style non-standard ERC-20, tokens with blocklists. Delegatecall targets. User-supplied? Then it is arbitrary code execution with your storage. Signature handling. ecrecover returning address(0) on a malformed signature, missing chainId in the domain separator (cross-chain replay), missing nonce, malleable s. Callback ordering in bridges. Are messages processed before the state that authorises them is committed? Minute 18–20: Decide what to prove, and how You now have a list. Do not write the report yet — write the smallest thing that turns a suspicion into a fact. EVM: a Foundry test with a vm.prank and a console2.log of the balance delta. If you cannot show a balance delta, you do not have a finding. Non-EVM / state-machine contracts: drive the protocol's own evaluator or VM in a script, send the trigger messages, and print the resulting state and outgoing payments. The table of payments is the proof. Both: assert the invariant that should hold (sum(payouts) <= amount) and show it breaking. Twenty minutes is not enough to audit a protocol. It is more than enough to decide whether the protocol has a shape worth auditing, and it is usually enough to find the one bug that matters — because the bugs that matter live in the replay key, the share formula, the queue loop, and the owner's powers, and those are four places, not four thousand. The short version Prove the deployed bytecode matches the source, and read the constructor args. Map value in, value out, and who moves it without depositing. Inventory every uniqueness key; find the caller-controlled field in the hash. Check share arithmetic for rounding and zero-share deposits. List owner powers, pause paths, and every break in a user-ordered loop. Check external calls and token assumptions. Write the PoC before the prose. If you only have five minutes, do 1, 3, and 5. That is where the money is.
How I Approach the First 20 Minutes of a Smart Contract Audit
Full Article
Original Source
Read the full article at Hackernoon →KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.