March 2019
Intermediate to advanced
636 pages
27h 50m
English
Be very careful when interacting with other external contracts, it should be the last step in your function. It can introduce several unexpected risks or errors. External calls may execute malicious code. These kinds of calls should be considered as potential security risks and avoided if possible.
pragma solidity ^0.4.24;// THIS CONTRACT is INSECURE - DO NOT USEcontract Fund { mapping(address => uint) userBalances;function withdrawBalance() public { //external call if (msg.sender.call.value(userBalances[msg.sender])()) userBalances[msg.sender] = 0;}}contract Hacker { Fund f; uint public count; event LogWithdrawFallback(uint c, uint balance); function Attacker(address vulnerable) public { f = ...Read now
Unlock full access