Vulnerable and fixed Solidity smart contract examples by Blockhertz.
Real Solidity vulnerability examples with fixes. Each folder contains a vulnerable contract and its secure version with detailed NatSpec comments explaining the bug, the exploit path, and the fix.
Use these to learn how smart contracts get drained — and how to stop it.
| Vulnerability | Vulnerable | Fixed |
|---|---|---|
| Reentrancy | reentrancy/Vulnerable.sol | reentrancy/Fixed.sol |
| Access Control | access-control/Vulnerable.sol | access-control/Fixed.sol |
| Integer Overflow | integer-overflow/Vulnerable.sol | integer-overflow/Fixed.sol |
| Oracle Manipulation | oracle-manipulation/Vulnerable.sol | oracle-manipulation/Fixed.sol |
| Front-Running | front-running/Vulnerable.sol | front-running/Fixed.sol |
| Unchecked Returns | unchecked-returns/Vulnerable.sol | unchecked-returns/Fixed.sol |
Run the Blockhertz AI Auditor on any of these contracts: blockhertz.com/tools/ai-auditor
Or use the hardhat-blockhertz plugin in your own project:
npm install hardhat-blockhertz
npx hardhat blockhertz-audit- Reentrancy Attack Guide
- Access Control Vulnerability
- Integer Overflow Guide
- Smart Contract Security Hub
- Free AI Auditor
blockhertz.com — AI-powered blockchain engineering platform with free developer tools.
MIT © Blockhertz