-
Notifications
You must be signed in to change notification settings - Fork 4
14. GatekeeperTwo
r1oga edited this page Oct 29, 2022
·
1 revision
Make it through the gatekeeper two.
-
gateOnerelies ontx.origin. - Being able to read the public contract logic teaches how to pass
gateTwoandgateThree.
Inline assembly & contract creation/initialization
From the Ethereum yellow paper section 7.1 - subtleties we learn:
while the initialisation code is executing, the newly created address exists but with no intrinsic body codeβ΄. 4. During initialization code execution, EXTCODESIZE on the address should return zero [...]
-
gateOne: similar to the gateOne of Level 13 - Gatekeeper One or to the hack of Level 4 - Telephone -
gateTwo: call theenterfunction during contract initialization, i.e from withinconstructorto ensureEXTCODESIZE = 0 -
gateThree
uint64(bytes8(keccak256(abi.encodePacked(msg.sender)))) ^ uint64(_gateKey)noteda ^ bmeansa XOR b.
uint64(0) - 1: underflow, this is equals touint64(1).
So we need to take_gatekey = ~msg.sender(Bitwise NOT) to ensure that the XOR product of each bit ofaandbwill be 1.
During contract initialization, the contract has no intrinsic body code and its extcodesize is 0.