The MysteryBox::changeOwner lacks critical security checks, including zero address validation for the new owner, access control restrictions, and event emissions to log ownership changes. These omissions can lead to accidental or malicious transfer of contract ownership, potentially resulting in loss of control over the contract's critical functions.
In this example, anyone can call changeOwner() and set the owner to any address, including the zero address.
Potential loss of contract control
Irreversible transfer to invalid addresses
Lack of transparency in ownership changes
Unauthorized transfers by any user
Manual Review, Foundry
Implement zero address validation:
Add access control:
Emit an event for ownership transfer:
Implement change of ownership process:
These changes will significantly enhance the security and transparency of the ownership transfer process.
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.