Smart Contract Security Checklist
Security Assessment Tool
Check off security measures you've implemented in your smart contract to estimate potential financial risk from vulnerabilities. Based on data from over $1.1B in smart contract losses.
Security Measures
Smart contracts are supposed to be trustless, automatic, and secure. But in practice, they’re full of hidden traps. One line of bad code can drain millions. The 2016 DAO hack wasn’t an anomaly-it was a warning. Since then, over $1.1 billion has been lost to smart contract flaws. And it’s still happening. Every month. In 2023 alone, DeFi protocols lost $4.7 million per incident on average. That’s not hacking a bank. That’s exploiting a piece of code that was never meant to be this fragile.
Reentrancy Attacks: The Recursive Drain
Imagine you withdraw $100 from an ATM. Before the machine updates your balance, someone else pulls the same $100 again-and again-and again. That’s a reentrancy attack. It happens when a contract calls an external function before finishing its own state changes. The attacker’s contract calls back into the vulnerable contract, triggering the same function over and over, draining funds before the balance is updated.
The DAO hack was the most famous example. Attackers used this technique to steal $60 million. In 2024, a lending protocol lost $1.2 million the same way. The fix? Update state before calling out. Use OpenZeppelin’s ReentrancyGuard, which adds a simple lock to block recursive calls. It adds less than 1% extra gas cost. Not using it? You’re leaving the door wide open.
Access Control: Who Really Owns This Contract?
Access control is the #1 most expensive vulnerability. It caused $953.2 million in losses by 2023. Why? Because developers assume only the owner can call certain functions. But they forget to check who’s actually calling them.
Some contracts use tx.origin to verify the user. That’s a mistake. tx.origin gives you the original sender of the transaction, even if it went through a middleman contract. An attacker can create a simple contract that calls your contract, and now tx.origin looks like a legitimate user. The real fix? Use msg.sender-it tells you who directly called the function. Always.
Another common error: leaving admin functions unguarded. If your contract has a function to mint new tokens or pause withdrawals, and it’s not restricted to one address, anyone can call it. Audit firms like Trail of Bits find this in 40% of new contracts they review. The fix? Use role-based access control (RBAC). OpenZeppelin’s AccessControl contract lets you define roles like OWNER, ADMIN, or PAUSER-and only those with the right role can execute sensitive actions.
Oracle Manipulation and Flash Loan Attacks
Smart contracts don’t know real-world prices. They rely on oracles-external data feeds-to tell them the price of ETH, BTC, or a token. But if you can trick the oracle, you can trick the whole contract.
Flash loan attacks are the most dangerous way to do this. An attacker borrows millions of dollars in a single transaction-no collateral needed-uses that money to artificially inflate or crash a token’s price on a DEX, then triggers a contract that makes a bad decision based on that fake price. In November 2021, Abracadabra lost $13 million this way. The attacker borrowed $250 million in MIM, swapped it to push the token price way up, then took out a loan against the inflated collateral.
The solution? Use decentralized oracles like Chainlink that pull data from multiple sources. Don’t rely on a single price feed. Add time-weighted averages so sudden spikes don’t trigger actions. And never trust an oracle’s data without validating it against a second source. Chainlink integration adds 15-20% to deployment cost, but it’s cheaper than losing $10 million.
Integer Overflow and Underflow
Ethereum uses fixed-size integers. A uint8 can only hold numbers from 0 to 255. If you add 1 to 255, it doesn’t become 256-it wraps around to 0. That’s an overflow. Subtract from 0? It becomes 255-that’s underflow.
Attackers exploit this to manipulate balances. Say a contract checks if you have enough tokens to send. If your balance is 1 and you try to send 2, it should fail. But if the contract doesn’t check for underflow, it subtracts 2 from 1 and gets 255. Now you have 255 tokens you didn’t own. In 2023, Cobalt found integer flaws in 22% of their critical audits.
Solidity 0.8.0 and later automatically checks for overflows and underflows. If you’re still using 0.7.x or older, you’re at risk. Upgrade. If you can’t, use SafeMath libraries. Don’t write your own math functions. Someone else already made the mistake-you don’t need to repeat it.
Logic Errors: The Silent Killers
Reentrancy and access control are flashy. But logic errors? They’re quiet. They don’t make headlines. But they’re the most common cause of losses after access control.
Beanstalk, a DeFi protocol, lost $180 million in April 2022. Why? A function called transferTokenFrom() didn’t validate that the sender actually had permission to transfer those tokens. The attacker called it directly and moved funds out of other users’ accounts. No reentrancy. No oracle. Just a missing check.
These errors happen when developers overcomplicate the logic. They add too many conditions, too many edge cases. The contract works in testing-but fails in the wild. The fix? Simplicity. Write fewer lines. Test every path. Use formal verification tools like Certora or Slither. They scan your code and find logical gaps no human would catch in a rush.
Insecure Randomness and Phishing via tx.origin
Want to run a lottery on-chain? Don’t use block.timestamp, block.difficulty, or blockhash. Miners can manipulate these. In February 2022, the $FFIST token was drained of $110,000 because it used block.timestamp to pick a winner. The attacker could predict the result and front-run the draw.
Use Chainlink’s VRF (Verifiable Random Function). It’s on-chain randomness, cryptographically proven. No miner can cheat it.
And again-don’t use tx.origin. Ever. It’s not just insecure. It’s a phishing vector. A malicious contract can trick users into approving transactions that look like they’re going to a trusted dApp, but actually drain their wallet. QuickNode’s code examples show how msg.sender is the only safe choice for authentication.
Gas Limit and Loop Vulnerabilities
Every Ethereum block has a gas limit. If your contract tries to do too much in one transaction, it fails. That’s not a bug-it’s a feature. But developers forget it.
On Reddit, a user named SoliditySage described how a simple loop that processed all token holders broke during the 2023 Shanghai upgrade. The contract tried to distribute rewards to 10,000 wallets in one go. Gas limit exceeded. Transaction failed. Users lost their rewards. The fix? Batch processing. Distribute in chunks. Use pull payments instead of push payments. Let users claim their rewards one at a time.
Also, avoid loops that depend on user-controlled data. If someone adds 100,000 fake accounts, your contract can’t run. Design for scalability from day one.
How to Protect Yourself
There’s no magic bullet. But here’s what works:
- Use OpenZeppelin libraries. They’ve been audited by hundreds of developers. Don’t reinvent the wheel.
- Upgrade to Solidity 0.8.0+. Automatic overflow protection is non-negotiable.
- Never use
tx.origin. Always usemsg.sender. - Use decentralized oracles. Chainlink is the standard for a reason.
- Run automated tests with Slither or MythX. They catch 70% of common flaws before you deploy.
- Get a professional audit. For medium-sized contracts, expect $15,000-$50,000. It’s cheaper than losing $10 million.
- Use ReentrancyGuard, AccessControl, and SafeMath. These aren’t optional. They’re baseline.
Smart contracts aren’t magic. They’re code. And bad code gets exploited. The difference between a secure contract and a hacked one? Discipline. Testing. And knowing what not to do.
What’s Next?
The OWASP Smart Contract Top 10 is updating in early 2024. New categories like Cross-Chain Bridge Vulnerabilities are coming. Attacks are getting smarter. In 2022, the Wormhole bridge was hacked for $320 million through forged digital signatures. That wasn’t a coding error-it was a cryptographic flaw.
By 2026, Gartner predicts 75% of enterprise blockchain projects will have automated security tests built into their CI/CD pipelines. That’s the future. Right now, most teams still deploy contracts with no testing beyond “it compiles.”
If you’re building on blockchain, your job isn’t just to make it work. It’s to make it unbreakable.
What’s the most dangerous smart contract vulnerability?
Access control vulnerabilities are the most financially damaging, responsible for over $950 million in losses as of 2023. These occur when unauthorized users can execute privileged functions-like minting tokens or withdrawing funds-because the contract doesn’t properly verify who is calling it. Using tx.origin instead of msg.sender, or leaving admin functions unguarded, are common causes.
Can reentrancy attacks still happen in 2025?
Yes. Even in 2024, a DeFi lending protocol lost $1.2 million to a reentrancy attack. While tools like OpenZeppelin’s ReentrancyGuard make it easier to prevent, developers still write vulnerable code by accident-especially when integrating third-party contracts or skipping audits. Reentrancy isn’t gone; it’s just better understood now.
Are flash loan attacks getting worse?
They’ve increased by 320% from 2022 to 2023. Flash loans allow attackers to borrow millions without collateral for a single transaction, manipulate token prices on DEXes, and trigger bad logic in DeFi contracts. The 2021 Abracadabra exploit ($13 million) and multiple 2023 incidents show this is a growing threat. The fix is using time-weighted price oracles and avoiding single-source price feeds.
Why do so many contracts still use tx.origin?
Some developers misunderstand it. They think tx.origin is the user’s wallet address, but it’s actually the original external account that started the transaction-even if it went through multiple contracts. This makes it easy for attackers to create a malicious contract that pretends to be the user. The correct way is msg.sender, which always refers to the immediate caller. This mistake still appears in tutorials and beginner code.
How much does a smart contract audit cost?
For a medium-complexity contract, audits from firms like Trail of Bits or CertiK cost between $15,000 and $50,000 and take 2-4 weeks. Simple contracts may cost less; multi-chain or DeFi protocols with complex logic can exceed $100,000. Skipping an audit to save money is like driving without brakes-it might work until it doesn’t.
Is Solidity 0.8.0 really safer?
Yes. Solidity 0.8.0+ automatically checks for integer overflows and underflows, which were responsible for 22% of critical vulnerabilities in 2023 audits. Older versions required manual use of SafeMath libraries. If you’re still using 0.7.x or earlier, you’re exposing your contract to avoidable risks. Upgrading is one of the easiest and most effective security steps you can take.
Can I rely on automated tools instead of audits?
Automated tools like Slither, MythX, or Hardhat plugins catch common flaws-like reentrancy or unchecked external calls-but they miss complex logic errors. In tests, formal verification tools found 27% more vulnerabilities than traditional static analysis. Automated tools are essential for early detection, but professional audits are still required for high-value contracts. Think of them as seatbelts, not airbags.
MICHELLE SANTOYO
October 28, 2025 AT 12:49Olav Hans-Ols
October 29, 2025 AT 00:26Paul Lyman
October 29, 2025 AT 17:25Clarice Coelho Marlière Arruda
October 31, 2025 AT 11:19Brian Collett
October 31, 2025 AT 19:18Allison Andrews
November 2, 2025 AT 00:20Wayne Overton
November 2, 2025 AT 02:07Alisa Rosner
November 3, 2025 AT 03:56Lena Novikova
November 5, 2025 AT 02:19Kevin Johnston
November 6, 2025 AT 07:53Dr. Monica Ellis-Blied
November 7, 2025 AT 01:13Herbert Ruiz
November 8, 2025 AT 22:37Saurav Deshpande
November 9, 2025 AT 00:07Frech Patz
November 10, 2025 AT 14:01Derajanique Mckinney
November 11, 2025 AT 22:26Kirsten McCallum
November 12, 2025 AT 04:25Henry Gómez Lascarro
November 13, 2025 AT 20:44Will Barnwell
November 14, 2025 AT 19:30Lawrence rajini
November 15, 2025 AT 21:32Matt Zara
November 16, 2025 AT 13:32Jean Manel
November 16, 2025 AT 16:04MICHELLE SANTOYO
November 17, 2025 AT 23:48