Best Practices
Solidity Attack Vector #11: No Address Zero Check
SecurityInfinity Research•4 min read
Solidity Attack Vector #11: No Address Zero Check
The 'Zero Address' (0x000...) is a special address in Ethereum. Accidentally sending tokens or Ether to this address results in the funds being permanently lost.
The Risk
Many functions that initialize an owner or a recipient don't check if the address provided is the zero address.
Fix
Always add a requirement for critical address inputs:
`solidity
require(_recipient != address(0), "Zero address not allowed");
`