Description: In Solidity, address(0) is often used to represent a null or uninitialized address. Failing to check for address(0) when assigning values to address state variables can lead to unintended behavior or vulnerabilities, as address(0) is typically not a valid or desired address in most contexts.
Impact:
Logic Errors: Assigning address(0) could lead to incorrect logic execution, as it might represent an uninitialized or invalid state.
Security Risks: Functions that rely on valid address checks could be bypassed if address(0) is inadvertently used.
Loss of Funds: Sending Ether or tokens to address(0) results in irretrievable loss, as it acts as a burn address.
Proof of Concept: Consider a function that sets an owner address without checking for address(0):
In this example, calling setOwner(address(0)) would set the owner to an invalid address, potentially disrupting contract functionality.
Recommended Mitigation:
Add Checks: Implement checks to ensure that addresses being assigned are not address(0).
Use Modifiers
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.