Smart Contract Security
Smart contract security is the practice of keeping blockchain programs correct when any account or contract can call them with adversarial inputs. It protects assets, permissions, and system rules before and after code is deployed.
itOffensive security and application security | OpenSkills.info
Recommended first:smart-contract-development
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Smart Contract Security
A smart contract is a program that lives on a blockchain, and once it's live, nobody — not even its author — can just quietly go in and fix a mistake overnight. Traditional software gets a hotfix at 2 a.m. and a shrug the next morning. A contract usually doesn't get that unless somebody built in a way to change it in advance, and that "way to change it" turns out to be its own security problem, which is most of what this course is actually about.
Before blockchains, if a bank's ledger software had a bug, the bank paused it, patched it, and reconciled the books afterward. A public contract has no pause button unless one was written in ahead of time, and no ledger to reconcile except the one an attacker already rewrote in their favor. Immutability is the feature people signed up for. It is also why a bug here costs differently than a bug almost anywhere else in software.
One idea does most of the work: an invariant is a rule that must hold in every reachable state — "nobody can withdraw more than they put in" is a plain example. Security work here is mostly writing these rules down before writing any code, because a rule nobody stated is a rule no tool, however good, can ever check on your behalf.
The other idea is that every external call is a handoff of control, not just a function call returning a value. The contract on the other end of that call might call back into yours before your first call has finished — that's a reentrancy, and it's the bug that made "smart contract security" a phrase people needed in the first place. Order of operations, it turns out, is a security property.
Here's the part likely to surprise you if you came in expecting stories about clever code exploits: the single biggest cause of stolen funds isn't a bug in anyone's Solidity at all. It's a compromised key — someone getting hold of an account that was allowed to move funds or replace logic. A shared-signature wallet helps, but one with no time delay and no separation of roles is still one bad day from the identical outcome. The code can be flawless and the system can still fall over because of who was trusted, and how much.
None of this is provable-safe, ever. An audit checks one build at one moment in time; change the compiler settings or the deployed bytecode afterward and that evidence quietly stops describing what is actually running. What you actually get is a stack of overlapping evidence — tests, static analysis, an audit, live monitoring, a rehearsed incident response — that either agrees with itself or doesn't. Confidence, not certainty, is the product on offer.
Start with the Intro for the full trust-boundary walkthrough, the Cheatsheet when you need the vulnerability-to-control mapping fast, and Field Notes for what actually happens to teams that skip the boring parts anyway.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://ethereum.org/developers/docs/smart-contracts/security/
Supports
- public attack surface
- access control
- testing layers
- audits
- emergency stops
- recovery
- tool landscape
- https://ethereum.org/developers/docs/smart-contracts/formal-verification/
Supports
- formal specifications
- model checking
- theorem proving
- symbolic execution
- verification limits
- https://docs.soliditylang.org/en/latest/security-considerations.html
Supports
- public data
- reentrancy
- checks-effects-interactions
- gas-bounded loops
- call failures
- tx.origin
- arithmetic
- fail-safe design
- https://www.soliditylang.org/blog/2020/12/16/solidity-v0.8.0-release-announcement/
Supports
- checked arithmetic default
- unchecked blocks
- panic behavior
- release date
- https://scs.owasp.org/SCSVS/
Supports
- security verification control groups
- architecture
- code
- governance
- authorization
- oracle
- bridge and DeFi requirements
- https://docs.openzeppelin.com/contracts/5.x/access-control
Supports
- ownership
- role-based control
- role administration
- least privilege
- multisignature ownership
- timelocks
- access management
- https://docs.openzeppelin.com/upgrades-plugins/writing-upgradeable
Supports
- initializers
- implementation locking
- inheritance
- upgrade-safe writing
- https://docs.openzeppelin.com/upgrades-plugins/proxies
Supports
- proxy delegation
- stable proxy state
- upgrade authority
- storage layout
- https://docs.openzeppelin.com/contracts/5.x/api/utils#ReentrancyGuard
Supports
- reentrancy guard behavior and limits
- https://docs.chain.link/data-feeds/selecting-data-feeds
Supports
- oracle feed suitability
- market risk
- data quality and integration checks
- https://secure-contracts.com/
Supports
- secure development workflow
- static analysis
- fuzzing
- symbolic execution
- incident response
- tool roles
- https://secure-contracts.com/program-analysis/echidna/introduction/how-to-test-a-property.html
Supports
- property tests
- generated call sequences
- invariant design
- counterexamples
- https://github.com/crytic/slither
Supports
- static analysis
- detectors
- printers
- call graphs
- command usage
- licensing
- https://github.com/crytic/echidna
Supports
- property-based contract fuzzing
- command usage
- configuration
- licensing
- https://getfoundry.sh/forge/tests/overview
Supports
- Forge tests
- selection
- traces
- fuzz and invariant testing
- https://getfoundry.sh/forge/reference/inspect/
Supports
- storage-layout inspection command
- https://getfoundry.sh/forge/gas-tracking/gas-reports
Supports
- Forge gas reports and command option
- https://getfoundry.sh/cast/reference/
Supports
- deployed code
- read-only calls
- transaction receipts
- RPC usage
- https://docs.sourcify.dev/docs/how-to-verify/
Supports
- source
- metadata
- compiler input and deployed-bytecode verification
- https://github.com/sindresorhus/awesome
Supports
- required discovery starting point
- EVM Security and Ethereum list discovery
- https://github.com/kareniel/awesome-evm-security
Supports
- EVM security ecosystem discovery
- standards
- threats
- vulnerabilities
- controls
- https://github.com/bkrem/awesome-solidity
Supports
- Solidity security
- audit
- practice and tool discovery
- https://www.damnvulnerabledefi.xyz/
Supports
- DeFi security challenge topics and practice format
- https://ethernaut.openzeppelin.com/
Supports
- EVM contract security wargame
- https://github.com/d-xo/weird-erc20
Supports
- unexpected token callbacks
- return values
- fees
- balance changes
- upgrades
- blocklists
- decimals and permit behavior
- https://github.com/SunWeb3Sec/DeFiHackLabs
Supports
- Foundry-based reproduction of DeFi incidents
- https://blog.ethereum.org/2015/07/30/ethereum-launches
Supports
- Frontier launch date and live contract execution
- https://blog.ethereum.org/2016/07/20/hard-fork-completed
Supports
- DAO hard fork date and irregular state change
- https://www.soliditylang.org/blog/2017/03/15/solidity-0.4.10-release-announcement/
Supports
- require
- assert
- transfer
- revert and release date
- https://blog.openzeppelin.com/parity-wallet-hack-reloaded
Supports
- Parity multisignature delegate-call library failure and date
- https://blog.trailofbits.com/2018/10/19/slither-a-solidity-static-analysis-framework/
Supports
- Slither framework announcement
- date
- detectors and intermediate representation
- https://www.soliditylang.org/blog/2018/11/13/solidity-0.5.0-release-announcement/
Supports
- Solidity 0.5 explicitness and safety changes
- release date
- https://blog.ethereum.org/2019/01/15/security-alert-ethereum-constantinople-postponement
Supports
- fork postponement
- gas-cost change and reentrancy risk
- https://www.openzeppelin.com/news/safeguarding
Supports
- formal verification of contract-library properties with Certora
- https://scs.owasp.org/sctop10/archive/2023/Top10%3A2023/
Supports
- 2023 Smart Contract Top 10 categories
- https://www.openzeppelin.com/contracts
Supports
- OpenZeppelin Contracts components
- licensing and product role
- https://getfoundry.sh/
Supports
- Foundry toolchain
- testing
- local execution and command reference
- https://github.com/ConsenSysDiligence/mythril
Supports
- EVM symbolic execution
- vulnerability analysis and licensing
- https://www.certora.com/
Supports
- bytecode checked against formal rules
- audits and commercial product role
- https://docs.tenderly.co/introduction
Supports
- transaction simulation
- tracing
- state changes
- monitoring
- alerts and free account availability
- https://immunefi.com/
Supports
- bug bounties
- audit competitions
- managed triage
- disclosure and commercial platform role
- https://blog.trailofbits.com/2019/08/08/246-findings-from-our-smart-contract-audits-an-executive-summary/
Supports
- field notes: audit finding categories
- reentrancy prevalence versus data validation
- tool-detectable severity share
- https://blog.trailofbits.com/2025/06/25/maturing-your-smart-contracts-beyond-private-key-risk/
Supports
- field notes: compromised-key share of stolen funds
- key-management maturity levels
- Chainalysis 2024 statistic
- https://rekt.news/beanstalk-rekt
Supports
- field notes: Beanstalk flash-loan governance attack mechanism
- emergency execution bypass of proposal delay
