Level 1
Noob Hacker
Ethernaut 15
Gatekeeper Two
0 / 100 EXP
100 EXP to Junior Hacker
0%
Unlocked hints
Gatekeeper Two
0/3
Unlock a hint to view it here.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice Adapted from OpenZeppelin Ethernaut level 14. Original authorship and
/// source attribution are recorded in the challenge manifest.
contract GatekeeperTwo {
address public entrant;
modifier gateOne() {
require(msg.sender != tx.origin, "GatekeeperTwo: gate one");
_;
}
modifier gateTwo() {
uint256 size;
assembly {
size := extcodesize(caller())
}
require(size == 0, "GatekeeperTwo: gate two");
_;
}
modifier gateThree(bytes8 gateKey) {
require(
uint64(bytes8(keccak256(abi.encodePacked(msg.sender)))) ^ uint64(gateKey) == type(uint64).max,
"GatekeeperTwo: gate three"
);
_;
}
constructor(bytes8 gateKey) gateOne gateTwo gateThree(gateKey) {
entrant = tx.origin;
}
}
Starter exploit
Exploit.s.sol
// TODO: implement the exploit.
contract HelperContract {
}
function run() external {
vm.startBroadcast(PLAYER_PRIVATE_KEY);
vm.stopBroadcast();
}
Ready to test your exploit?
The starter code is yours to inspect. Sign in to edit it, run Foundry, and keep every clear.
Contract line
Add audit note
0 / 300
CTF tour
Exploit Challenge
This is your guided Solidity CTF workspace.
Keep your audit trail
Sign in to save private notes on contract lines and continue your review later.
Delete this audit note?
This removes it permanently from your private workspace.
