Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Smart Contract Security Examples

A collection of vulnerable and secure Solidity smart contract examples for educational purposes.

Built and maintained by the Blockhertz team.


Purpose

This repository helps blockchain developers understand common smart contract vulnerabilities by showing:

  • ❌ Vulnerable code (what NOT to do)
  • ✅ Secure code (the correct pattern)
  • 📖 Explanation of each vulnerability
  • 🔧 How to fix it

Vulnerabilities Covered

1. Reentrancy Attack

The most common smart contract vulnerability. Caused the $60M DAO hack in 2016.

📁 vulnerabilities/reentrancy/ 📖 Full Guide

2. Missing Access Control

Anyone can call privileged functions. Caused the $611M Poly Network hack.

📁 vulnerabilities/access-control/ 📖 Full Guide

3. Integer Overflow/Underflow

Real example: BEC Token hack — $900M (2018) ▶️ Video Demo

📁 vulnerabilities/integer-overflow/ 📖 Full Guide

4. tx.origin Authentication

📁 vulnerabilities/tx-origin/ 📖 Coming soon ▶️ Coming soon

5. Front-Running

MEV bots exploit transaction ordering.

📁 vulnerabilities/front-running/ 📖 Coming soon


Free AI Smart Contract Auditor

Check your contracts for all these vulnerabilities automatically in 60 seconds.

🔍 Try Blockhertz AI Auditor Free

  • Paste any Solidity, Rust, Move, or Vyper contract
  • Get risk score (0-100)
  • See findings by severity
  • Get fix recommendations
  • No signup required

Other Free Blockhertz Tools

Tool Description
AI Smart Contract Auditor Security scan in 60 seconds
AI Architecture Generator C4 diagrams from text
AI Gas Optimizer Reduce gas costs automatically
AI Tokenomics Designer Token distribution + PDF report

Resources


Contributing

Found a vulnerability example we missed? Open a PR — contributions welcome!


License

MIT License — free to use for educational purposes.


⭐ Star this repo if it helped you!

About

Vulnerable and secure Solidity examples for learning smart contract security. Free AI auditor: blockhertz.com/tools/ai-auditor

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages