Awesome
🧑🏻🚀 my foundry framework to solve ethernaut: write-ups + solutions
<br>🔋 this project contains solutions for openzeppelin's ethernaut wargames. leveraging foundry, each level has a test set (test/*.t.sol
), a script set (script/*.s.sol
), and a write-up. some levels also have an exploit at src/*.sol
.
🔋 to read the full notes about this work, check out my mirror publication: on hacking systematically with foundry. you are welcome to submit solutions and pull requests.
🔋 by the way, do you remember overthewire? here is my WeChall profile from playing it in 2014.
<br> <p align="center"> <img width="400" src="https://github.com/go-outside-labs/ethernaut-foundry-writeups-sol/assets/138340846/32fb029d-852e-493b-8f79-939fe39d5455"> </p>levels
<br>✅ 01. Fallback - exploiting fallback()
:
✅ 02. Fallout - exploiting constructor()
:
✅ 03. Coin Flip - exploiting pseudo-randomness:
✅ 04. Telephone - exploiting tx.origin
:
✅ 05. Token - exploiting integer overflows:
✅ 06. Delegation - exploiting delegatecall
:
✅ 07. Force - exploiting payable contracts:
✅ 08. Vault - exploiting private functions:
✅ 09. King - exploiting transfer(msg.value)
:
✅ 10. Reentrancy - exploiting reentrancy:
✅ 11. Elevator - exploiting interfaces:
🔜 12. Privacy:
🔜 13. Gatekeeper One:
🔜 14. Gatekeeper Two:
🔜 15. Naught Coin:
🔜 16. Preservation:
🔜 17. Recovery:
🔜 18. Magic Number:
🔜 19. Alien Code:
🔜 20. Denial:
✅ 21. Shop - exploiting interfaces II:
🔜 22. Dex:
🔜 23. Dex Two:
🔜 24. Puzzle Wallet:
🔜 25. Motorbike:
🔜 26. Doubly Entry Point:
🔜 27. Good Samaritan:
🔜 28. Gatekeeper Three:
🔜 29. Switch:
<br>installing
<br>-
install foundry
-
create a test wallet (e.g., with metamask)
-
create a
.env
(copying from.env.example
) and add keys and the addresses of each instance. -
add a sepolia rpc url to
foundry.toml
(e.g., from alchemy or infura)
running each level
<br>- you will find detailed instructions in each write-up, but as a general rule:
- run tests with, for example,
forge test -vvvv
, or, for example,forge test -vvvv --match-path ./test/01/Fallback.t.sol
- submit scripts with, for example,
forge script ./script/01/Fallback.s.sol --broadcast -vvvv --rpc-url sepolia
<br>