04.SWC-104_Unchecked Call Return Value
2023-07-13 15:50:12 # 09.SWC

SWC-104_Unchecked Call Return Value

Unchecked Call Return Value

  • Description: The return value of a message call is not checked. Execution will resume even if the called contract throws an exception. If the call fails accidentally or an attacker forces the call to fail, this may cause unexpected behaviour in the subsequent program logic.

  • Remediation: If you choose to use low-level call methods, make sure to handle the possibility that the call will fail by checking the return value.

vulnerable contract:

1
2
3
4
5
6
7
8
9
10
11
12
pragma solidity 0.4.25;

contract ReturnValue {

function callchecked(address callee) public {
require(callee.call());
}

function callnotchecked(address callee) public {
callee.call();
}
}
Prev
2023-07-13 15:50:12 # 09.SWC
Next