Home

Awesome

Damn Vulnerable DeFi

Damn Vulnerable DeFi is the smart contract security playground for developers, security researchers and educators.

Perhaps the most sophisticated vulnerable set of Solidity smart contracts ever witnessed, it features flashloans, price oracles, governance, NFTs, DEXs, lending pools, smart contract wallets, timelocks, vaults, meta-transactions, token distributions, upgradeability and more.

Use Damn Vulnerable DeFi to:

Install

  1. Clone the repository.
  2. Checkout the latest release (for example, git checkout v4.0.0)
  3. Rename the .env.sample file to .env and add a valid RPC URL. This is only needed for the challenges that fork mainnet state.
  4. Either install Foundry, or use the provided devcontainer (In VSCode, open the repository as a devcontainer with the command "Devcontainer: Open Folder in Container...")
  5. Run forge build to initialize the project.

Usage

Each challenge is made up of:

To solve a challenge:

  1. Read the challenge's prompt.
  2. Uncover the flaw(s) in the challenge's smart contracts.
  3. Code your solution in the corresponding test file.
  4. Try your solution with forge test --mp test/<challenge-name>/<ChallengeName>.t.sol. If the test passes, you've solved the challenge!

Challenges may have more than one possible solution.

Rules

Troubleshooting

You can ask the community for help in the discussions section.

Disclaimer

All code, practices and patterns in this repository are DAMN VULNERABLE and for educational purposes only.

DO NOT USE IN PRODUCTION.