Level 1
Noob Hacker
Ethernaut 17
Preservation
0 / 100 EXP
100 EXP to Junior Hacker
0%
Unlocked hints
Preservation
0/3
Unlock a hint to view it here.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract LibraryContract {
uint256 public storedTime;
function setTime(uint256 time) external {
storedTime = time;
}
}
/// @notice Adapted from OpenZeppelin Ethernaut level 16.
contract Preservation {
address public timeZone1Library;
address public timeZone2Library;
address public owner;
uint256 public storedTime;
constructor(address libraryOne, address libraryTwo) {
timeZone1Library = libraryOne;
timeZone2Library = libraryTwo;
owner = msg.sender;
}
function setFirstTime(uint256 timeStamp) external {
timeZone1Library.delegatecall(abi.encodeWithSignature("setTime(uint256)", timeStamp));
}
function setSecondTime(uint256 timeStamp) external {
timeZone2Library.delegatecall(abi.encodeWithSignature("setTime(uint256)", timeStamp));
}
}
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.
