Structured pre-audit pass
A pre-audit pass is a fixed, ordered sweep that produces a scope map and a triaged finding list — it exists so a formal audit (or a deploy) starts from known state, not a blank page.
Procedure
- Freeze scope: record the commit hash (
git rev-parse HEAD), the file list under audit, and out-of-scope dependencies.
- Build and test clean:
forge build && forge test must pass with 0 failures before any manual review.
- Run the size and layout checks:
forge build --sizes and forge inspect <C> storage-layout for every contract holding funds.
- Map the system: for each contract, list external entry points, privileged functions, and assets it controls. Write the result to
scope.md.
- Walk the known-vuln checklist against the map (SWC / OWASP SCSVS): reentrancy, access control, oracle, flash loan, rounding, ERC-20 quirks, proxy, size.
- Run the automated tools and record raw output:
slither ., forge test --match-test invariant, forge test --fuzz-runs 5000.
- For each candidate finding, write the reachability argument: who calls it, with what input, at what cost.
- Rank findings: critical (funds at risk, no preconditions), high (funds at risk with a precondition), medium (griefing/DoS), low/informational.
- Produce a PoC or a written trace for every critical/high; skip nothing above medium without a stated reason.
- Write handover notes: what was tested, what was not, open questions for the auditors, and the tool versions.
Pitfalls
- Reviewing against
main while the deploy branch differs; freeze the exact commit.
- Trusting the test suite: 100% line coverage says nothing about adversarial paths, only that lines executed.
- Skipping the storage-layout check on a proxy upgrade because "nothing changed" — an inherited base reorder breaks it.
- Running Slither once and treating zero HIGH as "safe"; it is a floor, not a ceiling.
- No written scope, so the auditors double-check the boring parts and miss the novel logic.
- Forgetting to record the Solidity version and dependency versions (
forge --version, git submodule status), so a finding cannot be reproduced later.
Verification
forge build && forge test && slither . --config-file slither.config.json
Pass: build and tests clean, Slither output captured to a file, scope.md lists every in-scope contract with its entry points, and each critical/high has a PoC link.
Report the commit hash, the finding counts by severity, and what was left unverified.
1---2name: structured-pre-audit-pass3description: Use when starting a security review of a codebase before a formal audit or a deploy. Runs a fixed pre-audit checklist across build, scope, invariants and known vulnerability classes.4metadata:5 source: https://skillmd.com/skills/jiayaoqijia/structured-pre-audit-pass6---78# Structured pre-audit pass910A pre-audit pass is a fixed, ordered sweep that produces a scope map and a triaged finding list — it exists so a formal audit (or a deploy) starts from known state, not a blank page.1112## Procedure13141. Freeze scope: record the commit hash (`git rev-parse HEAD`), the file list under audit, and out-of-scope dependencies.152. Build and test clean: `forge build && forge test` must pass with 0 failures before any manual review.163. Run the size and layout checks: `forge build --sizes` and `forge inspect <C> storage-layout` for every contract holding funds.174. Map the system: for each contract, list external entry points, privileged functions, and assets it controls. Write the result to `scope.md`.185. Walk the known-vuln checklist against the map (SWC / OWASP SCSVS): reentrancy, access control, oracle, flash loan, rounding, ERC-20 quirks, proxy, size.196. Run the automated tools and record raw output: `slither .`, `forge test --match-test invariant`, `forge test --fuzz-runs 5000`.207. For each candidate finding, write the *reachability* argument: who calls it, with what input, at what cost.218. Rank findings: critical (funds at risk, no preconditions), high (funds at risk with a precondition), medium (griefing/DoS), low/informational.229. Produce a PoC or a written trace for every critical/high; skip nothing above medium without a stated reason.2310. Write handover notes: what was tested, what was not, open questions for the auditors, and the tool versions.2425## Pitfalls2627- Reviewing against `main` while the deploy branch differs; freeze the exact commit.28- Trusting the test suite: 100% line coverage says nothing about adversarial paths, only that lines executed.29- Skipping the storage-layout check on a proxy upgrade because "nothing changed" — an inherited base reorder breaks it.30- Running Slither once and treating zero HIGH as "safe"; it is a floor, not a ceiling.31- No written scope, so the auditors double-check the boring parts and miss the novel logic.32- Forgetting to record the Solidity version and dependency versions (`forge --version`, `git submodule status`), so a finding cannot be reproduced later.3334## Verification3536 forge build && forge test && slither . --config-file slither.config.json3738Pass: build and tests clean, Slither output captured to a file, `scope.md` lists every in-scope contract with its entry points, and each critical/high has a PoC link.3940Report the commit hash, the finding counts by severity, and what was left unverified.