This repo solves all Ethernaut CTFs using Foundry framework. Each CTF has its solution file, comments to explain the solution, and logging results in the cmd for better understanding. Feel free to mark a new issue if there is something not clear, or if there is an error in the solution.
- All Ethernaut CTFs smart contracts exist in
/src
folder. - Solutions are existed in
/script
folder. - The CTF solution file has the same name as CTF contract file name adding
.s
to it. - If the CTF challenge is
src/Fallback.sol
, the solution will bescript/Fallback.s.sol
. - The solution script deploys a new instance for the CTF smart contract, then cracks it.
It is better to have a version of forge
equal to or higher than the version of forge
that is being used in the repo, to avoid having any errors.
Repo forge version: forge 0.2.0 (same as cast, anvil, and chisel)
To update Foundry to the latest version you can write:
foundryup
- Clone the git repository.
git clone https://github.com/Al-Qa-qa/ethernaut-solutions-foundry
- Compile smart contracts, and build them.
forge install
forge build
- Run forge script for any challenge.
forge script script/Fallback.s.sol
We discuss every solution as an X (twitter) thread, you can check them out for deep understanding.
This project is under the MIT License. See LICENSE
for more information.
Al-Qa'qa' - @Al_Qa_qa - alqaqa.fighter@gmail.com
Project Link: https://github.com/Al-Qa-qa/ethernaut-solutions-foundary
Here are some of the services and websites that we used to make this project.
We would like to apologize if we used a free package or service and forgot to mention it.