Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 2 min read

DeFiHackLabs: Reproduce 914 DeFi Hacks with Foundry

What is DeFiHackLabs? DeFiHackLabs by SunWeb3Sec is an open-source repository that lets you reproduce past DeFi hacked incidents using Foundry. It contains 914 incidents, each with a proof-of-concept (PoC) written in S

What is DeFiHackLabs?

DeFiHackLabs by SunWeb3Sec is an open-source repository that lets you reproduce past DeFi hacked incidents using Foundry. It contains 914 incidents, each with a proof-of-concept (PoC) written in Solidity. The project aims to make Web3 more secure by providing hands-on learning material for developers, auditors, and security researchers. It is licensed under Apache-2.0, written in Solidity, and has 6.8k stars on GitHub at the time of writing.

Key Capabilities

  • Reproduce 914 DeFi hacks Each incident is a Foundry test that simulates the attack, from flash loans to oracle manipulation.
  • Web3 Cybersecurity Academy A structured curriculum with lessons in English, Chinese, Korean, Spanish, Japanese, and Vietnamese. Topics include on-chain transaction debugging, writing your own PoC for price oracle manipulation, MEV bots, rugpull analysis, reentrancy, and a full analysis of the Nomad Bridge hack (August 2022).
  • Transaction debugging tools The repo links to a curated list of tools for debugging Ethereum transactions.
  • Ethereum Signature Database and Useful tools sections Additional resources for security research.
  • Hacks Dashboard A visual overview of past incidents.
  • Community and contributions A Discord server for discussion and a Notion page with 101 root cause analyses of past DeFi hacks. All articles are also published on Substack.

How to Get Started

  1. Install Foundry by following the official instructions.
  2. Clone the repository:
 git clone https://github.com/SunWeb3Sec/DeFiHackLabs.git
 cd DeFiHackLabs
  1. Initialize submodules:
 git submodule update --init --recursive
  1. Run a PoC test, for example:
 forge test --contracts src/test/2026-11/sBOLD_exp.sol --evm-version cancun -vvv

Each incident is a standalone Foundry test file under src/test/.

Who Is This For?

For Solidity developers, smart contract auditors, and security researchers who want to learn from real-world DeFi exploits in a reproducible, hands-on environment. Also for CTF players and anyone preparing for security audits or bug bounty hunting.

Closing

DeFiHackLabs turns 914 real-world hacks into reproducible Foundry tests, backed by a multi-language academy and active community. It is a practical resource for understanding attack vectors and improving your own contract security.

https://github.com/SunWeb3Sec/DeFiHackLabs

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.