Balance relied on detector#
Name: balance-relied-on
Reports uses of address.balance
in strict equality comparisons and in state variable assignments.
A contract may forcefully receive Ether without a single payable
function implemented.
This is possible by selfdestructing another contract and sending the Ether to the address of the contract that relies on address.balance
.
Example#
- The contract relies on
address(this).balance
to check if the auction has started. An attacker can selfdestruct another contract and send the Ether to the address of the auction contract. This will make the auction start and allow the attacker to bid on it.
Parameters#
The detector does not accept any additional parameters.