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

πŸ‘Ύ my foundry framework and detailed solutions for each ethernaut level

Notifications You must be signed in to change notification settings

autistic-symposium/ethernaut-foundry-framework-solutions-sol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

82 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§‘πŸ»β€πŸš€ 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?)