Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Lack Of Zero Address Check In `MysteryBox::changeOwner` Can Lead To Loss Of Ownership.

Summary

The changeOwner function does not validate the _newOwner parameter, allowing the contract owner to be set to the zero address, effectively disabling ownership.

Vulnerability Details

Lack of zero-address check in changeOwner could lead to loss of ownership:

function changeOwner(address _newOwner) public {
owner = _newOwner; // No validation for the zero address
}

Impact

Assigning the zero address as the owner can leave the contract without an owner, potentially preventing further ownership changes or administrative actions. This could lead to a loss of control over the contract.

Tools Used

Manual Review

Recommendations

Add a validation check to ensure the _newOwner is not the zero address:

function changeOwner(address _newOwner) public {
+ require(_newOwner != address(0), "Invalid new owner");
owner = _newOwner;
}
Updates

Appeal created

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.