SECURITY

Smart Contract Audit Process — What a Professional Security Audit

Covers, How Long It Takes, and What It Costs — The Ethereum ecosystem has lost over $6 billion to smart contract exploits since 2020. A professional security audit is the last line of defense before a production system goes live with real user funds. Here is exactly what that process looks like.

ClickMasters TeamJune 23, 202510 min read
$6B+ in exploits
Independent review
Economic attack modeling
Remediation and re-audit
Smart Contract Audit Process — What a Professional Security Audit Covers, How Long It Takes, and What It Costs

Complete Process Guide

Architecture, security, implementation, cost, and production requirements.

01

Strategy

02

Architecture

03

Delivery

What a Smart Contract Audit Is — and What It Is Not

A smart contract audit is an independent security review of your contract code, performed by engineers who did not write the code, looking for vulnerabilities that would allow an attacker to steal funds, manipulate state, or disrupt functionality. It is not: A code quality review (style, efficiency, readability), A test of whether the contract behaves as intended (that is what your test suite is for), A guarantee that no vulnerabilities exist (no audit can provide that guarantee), A one-time certification (each contract modification requires a new audit of the changed code).

Phase 1: Pre-Audit Preparation (Developer Responsibility)

  • Internal code review. Senior engineer who did not write the contract reviews it against the specification, checks for common Solidity vulnerability patterns, and verifies that the contract's behavior matches the intended specification in all edge cases.
  • Automated static analysis. Slither identifies common vulnerability patterns (reentrancy, integer overflow, unchecked return values, access control issues) across all contract functions. Mythril performs symbolic execution to identify specific execution paths that could produce exploitable states. Echidna runs property-based fuzz testing to find edge cases that violate invariants.
  • Test coverage verification. Minimum 95% line coverage and 90% branch coverage. Every function tested for both happy path and failure modes.
  • Freeze the code. The code submitted for audit must match the code that will be deployed. Any changes after audit submission invalidate the audit findings and require a re-audit.

Phase 2: Audit Firm Selection

  • Relevant experience. An auditor who has reviewed 50 DeFi lending protocols understands the economic attack vectors specific to lending markets.
  • Methodology transparency. A credible audit firm publishes their methodology — what vulnerability categories they check, how they structure their review, and what their finding severity definitions mean.
  • Turnaround time. Rushed audits produce incomplete findings. A standard audit for a 2,000 LoC protocol takes 3–4 weeks from submission to final report.
  • Reputation in the ecosystem. Trail of Bits, OpenZeppelin, Certik, Halborn, Spearbit, and Code4rena are recognized names in the ecosystem.

Phase 3: The Audit Engagement

Kickoff: The audit team reviews the specification, previous audit reports (if any), known issues documented by the developer, and the codebase structure before beginning their review. Manual review: Each contract reviewed line-by-line by at least two auditors. Findings documented with: vulnerability description, attack scenario, affected code location, and severity classification.

Severity classification:

  • Critical: Direct theft of funds, permanent contract lock, or arbitrary state manipulation. Must be fixed before deployment.
  • High: Significant financial loss under specific conditions, partial contract lock. Must be fixed before deployment.
  • Medium: Protocol behavior deviates from specification in ways that could be exploited. Should be fixed before deployment.
  • Low: Minor issues that do not create direct financial risk. Should be documented and addressed in the next development cycle.
  • Informational: Code quality, gas efficiency, or specification clarification items. No remediation requirement.

Phase 4: Economic Attack Modeling (DeFi-Specific)

  • Flash loan attack simulation: Can an attacker borrow large capital within a single block, manipulate the protocol's price or liquidity state, and repay before block end — extracting value from honest protocol participants?
  • Oracle manipulation modeling: If the protocol uses spot price oracles, can an attacker manipulate the oracle price to trigger incorrect liquidations, allow undercollateralized borrowing, or drain liquidity at artificially favorable prices?
  • Governance attack scenario: Can an attacker acquire temporary governance token majority and pass a malicious proposal in a single block — before the timelock activates?
  • Liquidity cascade stress test: Under a 50% collateral price drop scenario, does the liquidation engine process liquidations fast enough to prevent bad debt accumulation?

Phase 5: Remediation and Re-Audit

  • Remediation: The development team fixes all Critical and High findings. Medium findings are addressed or documented with explicit justification for deferral.
  • Re-audit: The audit firm re-reviews all remediated findings to confirm the fix does not introduce new vulnerabilities.
  • Final report: The audit firm publishes the final report including: all original findings, remediation status for each, and re-audit confirmation.

Audit Cost Reference

ScopeLines of CodeTypical CostTimeline
Single simple contract100–300 LoC$5,000–$12,0001–2 weeks
Single complex contract300–800 LoC$10,000–$25,0002–3 weeks
Small protocol (2–4 contracts)800–2,000 LoC$20,000–$45,0003–4 weeks
Mid-size DeFi protocol2,000–5,000 LoC$40,000–$80,0004–6 weeks
Large protocol with economic modeling5,000+ LoC$80,000–$150,000+6–10 weeks
FAQ

Frequently Asked Questions

Common questions about this process, implementation, security, cost, and production requirements.

Who audits smart contracts?

Specialized blockchain security firms: Trail of Bits, OpenZeppelin, Certik, Halborn, Spearbit, PeckShield, Quantstamp, and others. Competitive audit platforms like Code4rena and Sherlock crowdsource audits to a pool of independent security researchers. The choice depends on your protocol type, budget, and the level of brand recognition you want associated with the audit.

Can we use Code4rena instead of a traditional audit firm?

Competitive audit platforms can find vulnerabilities that traditional audits miss — a large pool of researchers applying diverse mental models to the code. However, the format (time-boxed competition rather than systematic methodology) means specific vulnerability categories may not be covered if no researcher prioritized them. For production DeFi protocols, a traditional firm audit is recommended, optionally supplemented by a Code4rena competitive audit.

What happens if a vulnerability is found post-audit?

If your audit was complete and up-to-date at deployment, most credible audit firms will review any post-deployment vulnerability to determine if it was present in the audited code. If it was present and not found: this is a coverage miss. If it was introduced after the audit: it is not the auditor's finding to have caught. No code modification after audit is permitted without a re-audit.

Start Your Project

Ready to Secure Your Smart Contracts?

Let's coordinate your security audit engagement.

Related Guides

More process guides