Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Latest commit

 

History

History

unchecked_external_call

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Unchecked External Call

Certain Solidity operations known as "external calls", require the developer to manually ensure that the operation succeeded. This is in contrast to operations which throw an exception on failure. If an external call fails, but is not checked, the contract will continue execution as if the call succeeded. This will likely result in buggy and potentially exploitable behavior from the contract.

Attack

  • A contract uses an unchecked address.send() external call to transfer Ether.
  • If it transfers Ether to an attacker contract, the attacker contract can reliably cause the external call to fail, for example, with a fallback function which intentionally runs out of gas.
  • The consequences of this external call failing will be contract specific.
    • In the case of the King of the Ether contract, this resulted in accidental loss of Ether for some contract users, due to refunds not being sent.

Mitigation

  • Manually perform validation when making external calls
  • Use address.transfer()

Example

References