Ethernaut 1 - Fallback Foundry Solution - Walkthrough Tutorial 2023
Johnny Time
š Ethernaut Challenge 1 - Fallback Foundry Solution 2023 š
Are you ready to take your Smart Contract Hacking skills to the next level? In this tutorial, we'll dive deep into solving the "Ethernaut 1 -Fallback" challenge using Foundry. Our goal is to change the ownership of the Fallback smart contract, and then drain it from ETH. I'll guide you through every step of the process.
š Prerequisites š
Before we start, make sure you've completed these prerequisites:
Watch the first video in our series on how to get started with Ethernaut and set up your Foundry environment for tackling challenges: https://www.youtube.com/watch?v=UWy-CcnulCA&list=PLKXasCp8iWpjYKwk0hcdVDVZlpW_NGEYS
Clone the Ethernaut Foundry Solutions Repository on GitHub (don't forget to leave a star š): https://github.com/RealJohnnyTime/ethernaut-foundry-solutions-johnnytime
Subscribe to the JohnnyTime YouTube channel for more tutorials, updates, and the full Ethernaut Foundry Solutions playlist.
šØāš» Become a Certified Smart Contract Hacker š©āš»
If you're looking to turn Smart Contract Hacking into a career, check out our full Smart Contract Hacking Course. Gain in-depth knowledge, practice with hands-on exercises, and receive an official Smart Contract Hacker certificate, use the following discount link: https://johnnytime.xyz/smart-contract-hacker
š§ Understanding the Challenge š§
Our objective in the Fallback smart contract is to claim ownership and then drain all the ETH from the contract. The contract sets the owner as the msg.sender upon deployment. And we need somehow to update this owner variable.
š Spotting the Vulnerability š
To update the owner through the receive function, you need to meet specific criteria:
- Send more than 0 ETH in msg.value, even as little as 1 WEI.
- Have a record in the contributions mapping, indicating a contribution of at least 1 WEI to the smart contract.
You can accomplish this by following these steps:
- Call the contribute function, contributing 1 WEI.
- Place a call to the contract without additional data, sending 1 WEI to activate the receive function.
See you in the next tutorial! š
Timestamps 00:00 Intro 00:50 Fallback Challenge Overview 01:58 Smart Contract Overview 04:50 Challenge Solution 11:30 Summary ... https://www.youtube.com/watch?v=mQQFgWbSXyg
132570242 Bytes