Lack of Access Controls in changeOwner Function
The changeOwner function in the MysteryBox contract lacks proper access control mechanisms. This vulnerability allows any user to call the changeOwner function and pass an arbitrary address, which changes the owner variable without any restrictions. As a result, an unauthorized user can take over ownership of the contract.
The owner variable, which is critical for enforcing admin or onlyOwner functions, can be maliciously altered. This could lead to the original contract owner losing control over the contract and potentially losing any ETH or tokens held by the contract, as the new owner would gain full control.
Manual review
To mitigate this vulnerability, integrate OpenZeppelin's Ownable contract, which provides a secure implementation of ownership and includes an onlyOwner modifier. This modifier should be applied to all sensitive functions, including changeOwner, to restrict access to the current owner only.
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.