A vulnerability was found where an address state variable is assigned a value without checking if it's equal to the zero address (address(0)
). This could lead to unexpected behavior or security issues if the address is invalid.
Location: Line 171 in src/ChristmasDinner.sol
Type: Missing zero address check
Description: The _host
state variable is assigned a value without verifying if it's a valid address.
Potential loss of functionality: If an invalid address is assigned, it could break critical contract logic relying on this variable.
Security risks: Malicious actors could potentially exploit this by sending transactions to an invalid address.
Unexpected behavior: The contract may behave unexpectedly when trying to interact with the invalid address.
Slither static analysis tool identified this vulnerability.
Add a check to ensure the assigned value is not address(0)
before setting the _host
state variable:
Implement similar checks for all address state variables throughout the contract.
Consider using OpenZeppelin's Address library for additional safety checks:
Review all instances where addresses are assigned to state variables and add appropriate checks.
Implement comprehensive input validation for functions that accept address parameters.
Consider adding events for important state changes, including when an address is set:
By addressing this vulnerability, you'll improve the robustness and security of your smart contract by ensuring that only valid addresses are used as state variables.
address(0)
when assigning values to address state variablesCheck for address(0)
when assigning values to address state variables.
Found in src/ChristmasDinner.sol Line: 171
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.