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
Intro
Smart Contract Security
Smart contract security is the discipline of preserving a blockchain application's rules under hostile use. A contract receives public transactions, changes shared state, and may control assets. Every caller can choose inputs, timing, and transaction ordering. Another contract can call back during an interaction. A privileged account can also become an attack path if its key or governance process fails.
This course uses Ethereum Virtual Machine (EVM) contracts written in Solidity as the main model. The reasoning extends to other contract platforms, but their execution rules and tools differ. Security begins with the exact platform semantics rather than a list of language-level bugs.
The system and its trust boundaries
A deployed application usually contains more than one contract. Users and automated agents submit transactions through public entry points. Contracts read and write persistent storage, call other contracts, emit logs, and consume gas. Off-chain services supply data, relay signed messages, monitor events, and operate privileged accounts.
Treat each boundary as adversarial until the design states a narrower assumption:
- Caller boundary: any external account or contract may invoke a public or external function.
- Call boundary: an external call hands execution to code outside the current function. That code can revert, consume gas, or call back.
- Asset boundary: a token can have transfer behavior that differs from the receiving contract's assumptions.
- Data boundary: an oracle report can be stale, manipulated, or unsuitable for the value at risk.
- Authority boundary: owners, roles, multisignature wallets, timelocks, and upgrade administrators can change protected behavior.
- Deployment boundary: the address, bytecode, compiler settings, initialization, and chain must match the reviewed release.
These boundaries connect. A function that accepts an untrusted token may trigger an external callback. That callback may reach a second function whose access control or accounting assumes the first function has finished. Security review therefore follows whole state transitions, not isolated lines.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
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
