Level 1
Noob Hacker
Ethernaut 12
Elevator
0 / 100 EXP
100 EXP to Junior Hacker
0%
Unlocked hints
Elevator
0/3
Unlock a hint to view it here.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface Building {
function isLastFloor(uint256) external returns (bool);
}
contract Elevator {
bool public top;
uint256 public floor;
function goTo(uint256 _floor) public {
Building building = Building(msg.sender);
if (!building.isLastFloor(_floor)) {
floor = _floor;
top = building.isLastFloor(floor);
}
}
}
Starter exploit
Exploit.s.sol
// Already wired up for you - do NOT add imports or a contract wrapper:
// elevatorInstance -> the deployed Elevator contract
// PLAYER_PRIVATE_KEY / PLAYER_ADDRESS -> your key and address
// Write only the code below.
contract HelperContract {
// TODO: implement the exploit.
}
function run() external {
vm.startBroadcast(PLAYER_PRIVATE_KEY);
// TODO: implement the exploit.
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.
