Ethernaut — Level 14— Gatekeeper Two

This challenge is an extension to the previous level, the challenge covers a bit of assembly basics and other solidity programming concepts.

Click here to access the source code.

Investigation

To complete the challenge we need to pass three gates gateOne, gateTwo and gateThree which are modifiers and get the entrant role. Investigate the require statement of each modifier and pass a value to pass all the gates.

The gates

The Solution

Gate 1

As seen in the previous challenge, just by making a call to the deployed via our malicious contract we pass the Gate 1. i.e., msg.sender != tx.origin

Gate 2

extcodesize is used to find out if the msg.sender is an EOA or a contract but there is small hack to bypass the check. If extcodesize executes within the constructor of a small contract, the return value is 0.

Gate 3

A XOR B=C == A XOR C=B Interchanging the positions of the B and C yields the same result.

abi.encodeWithSignature helps call a function present on some other contract without the need to actually import the interface.

enter()

Thanks for Reading!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store