What is smart contract security?
Smart contract security is the work of making sure a contract does only what its authors intend, for every caller and every input, from the first design until it stops holding funds. It covers the code, how the code is deployed and upgraded, and the keys and people who can change it. This guide maps the main bug classes, the checks teams run at each stage, and where each part of our security library lives.
What does smart contract security cover?
A contract on a public chain runs exactly as written, and anyone can call it. A fix after launch needs an upgrade path planned in advance, and every upgrade path is something an attacker can aim at too. So the work covers four layers:
- The code. Logic, access control, arithmetic, external calls and the invariants the code must keep.
- What the code depends on. Price oracles, tokens that behave in unusual ways, other protocols it calls and the chain it runs on.
- Deployment and upgrades. Proxies, initializers, constructor arguments, admin roles and timelocks.
- Keys, signers and front ends. Who holds the keys, how they sign, and whether the transaction they see is the one they sign.
The last layer is where the record-breaking Bybit theft of February 2025 started. Chainalysis counted over $3.4 billion stolen from January through early December 2025, and the February compromise of Bybit alone accounted for $1.5 billion of that total.
| Protocol | Bybit |
|---|---|
| Date | 21 February 2025 |
| Chain | Ethereum |
| Loss | nearly $1.5B in ETH |
| What happened | Attackers gained access to the computer of a Safe developer and added malicious JavaScript to the Safe front end. A malicious transaction then looked like a routine transfer from Bybit cold storage to a hot wallet, Bybit signed it, and the attackers moved the funds. Chainalysis traces the attack to a developer machine and a front end, which a review of contract code never sees. |
| Sources | Chainalysis |
Bugs in contract code are the other large source of loss. The OWASP Smart Contract Top 10: 2026 is built on 122 deduplicated smart contract incidents from 2025, with about $905.4M in losses. The two figures count different things: Chainalysis counts all theft, including exchanges and personal wallets, while OWASP counts only incidents that involved smart contracts.
A code review, by a person or a tool, covers the first two layers and part of the third. Keys, signing and front ends need their own controls: hardware keys, a multisig with a clear signing policy, and a check of what each transaction does before anyone signs it.
What are the main smart contract bug classes?
OWASP orders its 2026 Top 10 from 2025 incident data and input from practitioners. Each row below links to our pages on that class. A class page has vulnerable and fixed Solidity, a real exploit with its sources and a checklist you can run on your own code.
| OWASP 2026 | What goes wrong | Our pages |
|---|---|---|
| SC01 Access control vulnerabilities | The wrong caller reaches an admin, upgrade or governance function. | Access control, Uniswap v4 hooks, tx.origin authentication |
| SC02 Business logic vulnerabilities | Every check passes, but the lending, swap, reward or governance mechanism still lets value leak. | Liquidation logic bugs, Reward accounting errors, Governance attack |
| SC03 Price oracle manipulation | The contract trusts a price that an attacker can move or that has gone stale. | Oracle price manipulation, Stale oracle price |
| SC04 Flash loan-facilitated attacks | Capital borrowed and repaid in one transaction turns a small flaw into a large drain. | Flash loan attack |
| SC05 Lack of input validation | A user, admin or cross-chain input is trusted without checks and corrupts state. | Cross-chain message validation, Signature replay |
| SC06 Unchecked external calls | A call that fails, reverts or calls back is not handled, and state is left inconsistent. | Unchecked external call |
| SC07 Arithmetic errors (rounding and precision) | Share, interest or swap math rounds the wrong way or loses precision. | Rounding and precision errors, ERC-4626 inflation attack |
| SC08 Reentrancy attacks | An external call re-enters the contract before its state updates finish. | Reentrancy, Read-only reentrancy |
| SC09 Integer overflow and underflow | Arithmetic wraps where checks are off, such as unchecked blocks and type casts. |
Integer overflow and underflow, Unsafe casting |
| SC10 Proxy and upgradeability vulnerabilities | An upgrade path, initializer or storage layout lets an attacker take over or corrupt the implementation. | Uninitialized proxy, Storage collision, Delegatecall vulnerability |
The vulnerability library lists every class page as it ships, and the exploit analyses trace real incidents back to their class. For what to check by protocol type, such as ERC-4626 vaults or lending markets, see audits by protocol type.
How do teams secure a contract from design to launch?
No single check covers the gaps of the others. Each one below catches a different kind of problem, and the cheap ones run on every commit.
| Check | What it finds | What it misses | When to run it |
|---|---|---|---|
| Design review and threat model | Wrong trust assumptions, roles that should not exist, incentives that fail when prices move | Bugs in code that implements a sound design | Before the code is written, and whenever the design changes |
| Unit tests and invariant tests | Code that breaks expected behaviour, and states where a rule such as "total shares match total assets" fails | Paths nobody thought to test | Every commit |
| Fuzzing | Inputs and call sequences nobody thought of | Bugs that need outside state the fuzzer does not model, such as a manipulated price | Short runs on every commit, longer runs before an audit |
| Static analysis | Known code patterns, in seconds | Logic and economic bugs, and many issues that cross contracts | Every commit |
| AI review | Logic and access control issues across contracts, with a proof of concept on some tools | Some bugs, and whether the design is sound. Some findings are wrong | Before a manual audit, and on every pull request after it |
| Manual audit | Design, economics and intent, plus bugs the tools missed | Code merged after the audited commit | Before launch and before a major upgrade |
| Bug bounty | Bugs in live code, found by outside researchers who are paid per valid finding | Anything researchers don't look at. It only starts once the code is live | From launch, for as long as the code holds funds |
| Monitoring and incident response | Attacks in progress and unexpected admin actions | It does not prevent a bug. It limits the damage once an attack starts | From deployment |
The ethereum.org security guide says unit testing is "minimally effective for improving smart contract security when used in isolation", and that teams should "avoid treating audits as a silver bullet". The same guide keeps lists of analysis tools, monitoring tools and bug bounty platforms.
The first months after launch carry the most risk. A working paper, Auditing Smart Contracts (October 2025 draft), studied DeFi protocols launched between January 2020 and January 2025 and found nearly 80% of hacks within the first six months of launch, so monitoring, a pause plan and a bounty belong in place on launch day rather than a few months later.
What should be in place before mainnet?
- Every privileged role is written down: what it can call, who holds it and how that key is secured.
- Admin and upgrade keys sit behind a multisig, and upgrades go through a timelock that users can watch.
- Core accounting has invariants, and fuzz or invariant tests run them on every commit.
- Static analysis runs on every commit, and each result is fixed or explained.
- A full AI review has run on the frozen commit, and each finding is fixed or answered.
- A manual audit covers the exact commit you will deploy, and a fix review covers the changes.
- The deployed bytecode matches the audited commit, and each proxy is initialized in its deployment transaction.
- Contracts emit an event for every safety-critical action, and alerts watch for those events.
- A written incident plan says who can pause what, and how they reach each other.
- A bug bounty is live, with payouts in proportion to the funds at stake.
- Pull request checks review every change made after the audit.
The audit readiness checklist covers the audit part in more detail, and the guide to reviewing changes since your last audit covers what happens after it.
Where does each part of our security library live?
- Vulnerability library: one page per bug class, with vulnerable and fixed Solidity, a real exploit and a review checklist.
- Exploit analyses: real incidents with a timeline, the root cause in code and the loss, each from primary sources.
- Glossary: short definitions of the terms on these pages, from invariant to proof of concept.
- EVM chains: what changes from chain to chain, such as sequencers, precompiles and bridges.
- Solidity: the language QuillShield supports today, in Foundry projects, and the bug classes that come up most in it.
- Audits by protocol type: what to check in vaults, hooks, lending markets, perpetual DEXs and AI-written Solidity.
- Audit readiness checklist and audit cost calculator: plan an audit and estimate what it costs.
- Compare: AI auditors and scanners side by side, with the team each one fits.
- Guides: step by step, from a first audit to pull request checks.
- AI audit agents and what a smart contract auditor does: who reviews code, and how.
Where does QuillShield fit?
We make QuillShield, and it covers one row of the table above: AI review. QuillShield runs a full audit of a Solidity codebase in a Foundry project. It builds a security graph of the code and lists the invariants the code must keep. A separate reviewer agent tries to disprove every finding before you see it, and each finding that holds up comes with the exact lines, the impact, a recommended fix and, on full audits, a proof of concept. It then checks every pull request on GitHub or GitLab.com against that graph.
QuillShield does not replace a manual audit. It reviews every change between audits, and you can request a manual audit from QuillAudits. It reviews code only, so keys, signing and front ends still need the controls described above.
Full audits start at $49 and are priced from the lines of Solidity in scope, as the pricing page shows as of November 2026. Sign-up is free, and new accounts get $50 in credit, good for up to half of an order. Run a full audit to see the exact price for your code before anything is charged.
FAQ
Is smart contract security the same as a smart contract audit?
No, an audit is one review of one commit, while security covers the design, tests, reviews, deployment, keys and monitoring for as long as the contract holds funds.
What is the most common smart contract vulnerability?
OWASP ranks access control vulnerabilities first in its Smart Contract Top 10: 2026, built from 2025 incident data, ahead of business logic flaws and price oracle manipulation. Our access control page shows what they look like in Solidity.
Does Solidity 0.8 make a contract safe?
No, because checked arithmetic only stops overflow and underflow outside unchecked blocks and does nothing about reentrancy, access control, oracle manipulation or logic errors, which make up most of the OWASP list.
Can an AI tool secure a smart contract on its own?
No, because AI review misses some bugs and does not judge whether a design is sound, even though it finds many known bug types and can check every change. Can AI audit smart contracts goes through the evidence.
When do most DeFi hacks happen?
Most happen early in the life of a protocol. A 2025 working paper on DeFi protocols launched between January 2020 and January 2025 found nearly 80% of hacks within the first six months of launch.
Sources
- 2025 crypto theft reaches $3.4 billion, Chainalysis checked 3 December 2026
- Collaboration in the wake of record-breaking Bybit theft, Chainalysis checked 3 December 2026
- OWASP Smart Contract Top 10: 2026, OWASP checked 3 December 2026
- Auditing Smart Contracts, working paper (October 2025 draft), Landsman, Lyandres, Maydew, Rabetti and Zhang checked 3 December 2026
- Smart contract security, ethereum.org checked 3 December 2026
- Manual smart contract audits, QuillAudits checked 3 December 2026