Force
Contents
in this challenge we are given this contract and our goal is to increase the balance of this contract, this might be weird because this contract is empty!
Challenge Info
- Platform: Ethernaut
- Challenge: Force
- Category: Blockchain
| |
lets first recall how we send ether, we do that by calling recieve or fallback functions right ? this is done via the CALL opcode that looks into the function’s code and execute it and that function logic will transfer ether
another way to send ether is via the SELFDESTRUCT opcode, what makes this opcode different from CALL is that it doesn’t look at the contract code, the evm just executes it and it will directly change the state of the blockchain, meaning it will transfer ether from the the function that is triggering it to the target address, more precisely :
when contract A executes SELFDESTRUCT(target_address), the target address will receive all the ether of contract A regardless the the bytecode deployed
now lets go and solve the challenge, first we check the balance of the contract that should be 0 :

perfect, now we write the solver script
| |
after running this we get :

so gg the challenge is solved !