Skip to content

Instantly share code, notes, and snippets.

@epheph
Created September 11, 2020 21:03
Show Gist options
  • Save epheph/460e6ff4f02c4ac582794a41e1f103bf to your computer and use it in GitHub Desktop.
Save epheph/460e6ff4f02c4ac582794a41e1f103bf to your computer and use it in GitHub Desktop.
bad-contract.sol
pragma solidity ^0.5.11;
// THIS CONTRACT HAS INTENTIONAL VULNERABILITY, DO NOT COPY
contract Victim {
mapping (address => uint256) public balances;
function deposit() external payable {
balances[msg.sender] += msg.value;
}
function withdraw() external {
uint256 amount = balances[msg.sender];
(bool success, ) = msg.sender.call.value(amount)("");
require(success);
balances[msg.sender] = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment