This repository contains the solutions for the Ethernaut CTF challenges from OpenZeppelin. The Ethernaut is a Web3/Solidity based wargame inspired by overthewire.org. Each level is a smart contract that needs to be hacked in order to advance to the next level. The challenges are designed to teach the basics of smart contract security and the vulnerabilities that can be found in Solidity code.
- The
challenges
folder contains all the initial Ethernaut smart contracts. - The
solutions
folder contains the explanations to understand how to beat each level. - The
src
folder contains the solutions for each level (solidity and/or scripts in the browser console). - The
script
folder contains the scripts to deploy the solutions contained in thesrc
folder. - The
helpers
folder contains some older OpenZeppelin contracts that are needed to compile the challenges. - The
test
folder contains tests for some levels.
await contract.password()
await contract.authenticate("ethernaut0")
FORK_URL=https://eth-sepolia.g.alchemy.com/v2/{API_KEY}
forge test -vvvv --fork-url $FORK_URL --match-path test/13_GateKeeperOne.test.sol
- Lvl 0 Hello Ethernaut
- Lvl 1 Fallback
- Lvl 2 Fal1out
- Lvl 3 Coin Flip
- Lvl 4 Telephone
- Lvl 5 Token
- Lvl 6 Delegation
- Lvl 7 Force
- Lvl 8 Vault
- Lvl 9 King
- Lvl 10 Re-entrancy
- Lvl 11 Elevator
- Lvl 12 Privacy
- Lvl 13 Gate Keeper 1
- Lvl 14 Gate Keeper 2
- Lvl 15 Naught Coin
- Lvl 16 Preservation
- Lvl 17 Recovery
- Lvl 18 MagicNumber
- Lvl 19 Alien Codex
- Lvl 20 Denial
- Lvl 21 Shop
- Lvl 22 Dex
- Lvl 23 Dex Two
- Lvl 24 Puzzle Wallet
- Lvl 25 Motorbike (unbeatable since Dencun upgrade, issue with selfdestruct new behavior, see EIP6780)
- Lvl 26 Double Entry Point
- Lvl 27 Good Samaritan
- Lvl 28 Gate Keeper 3
- Lvl 29 Switch
- Lvl 30 Higher Order
- Lvl 31 Stake