Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Latest commit

 

History

History
227 lines (132 loc) · 5.75 KB

File metadata and controls

227 lines (132 loc) · 5.75 KB

🧑🏻‍🚀 my foundry framework to solve ethernaut: write-ups + solutions


🔋 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.


levels


✅ 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:


installing


  • 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


  • 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




(like solving these types of problems? perhaps you are autistic cypherpunk, then?)