{"repo":"Ching367436/ethernaut-motorbike-solution-after-decun-upgrade","free":true,"listed":false,"github":"https://github.com/Ching367436/ethernaut-motorbike-solution-after-decun-upgrade","clone":"git clone https://github.com/Ching367436/ethernaut-motorbike-solution-after-decun-upgrade.git","description":"Ethernaut Motorbike Solution (After Dencun Upgrade)","language":"Solidity","stars":25,"topics":["ethernaut","selfdestruct","solidity","eip-6780","eip-7702"],"license":null,"category":"blockchain-web3","readme_excerpt":"Ethernaut Motorbike Solution (After Dencun Upgrade) Following the Dencun upgrade, the selfdestruct opcode behavior has been modified (EIP-6780). This change means that the selfdestruct no longer removes the contract code from the blockchain, rendering the Motorbike challenge seemingly unsolvable. However, there is a new approach to tackle this, which we will outline in this write-up. The solution before the Dencun upgrade Ethernaut's motorbike has a brand-new upgradeable engine design. Would you be able to selfdestruct its engine and make the motorbike unusable? Analysis Our goal is to selfdestruct the Engine . Let's look at it first. There are only 2 external/public functions: initialize and upgradeAndCall . Since the upgradeAndCall function looks more interesting, let's examine it first. upgradeAndCall The function first calls authorizeUpgrade() , which checks if msg.sender == upgrader . Therefore, we need to control upgrader to make it ourselves. There is only one place where we can control it: initialize . Let's examine it. initialize The initialize function has an initializer modifier, which checks if the contract is initialized yet. In our case, it is not, so we can make the upgrader ourselves. Let us return to the upgradeAndCall function. upgradeAndCall The upgradeToAndCall then calls upgradeToAndCall , which delegates the call to newImplementation , which we control. Therefore, if we set newImplementation to a contract that will call selfdestruct , the challenge will ","default_branch":null,"files":null,"tree":[],"storefront":"/r/Ching367436","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Ching367436/ethernaut-motorbike-solution-after-decun-upgrade/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}