The changeOwner
function allows any user to change the contract's owner without any restrictions, leading to unauthorized control over the contract.
The changeOwner
function lacks access control, meaning it does not verify if the caller is the current owner. This allows any address to execute the function and set themselves or any other address as the owner.
This vulnerability can lead to unauthorized access to functions restricted to the owner, such as withdrawFunds
, setBoxPrice
, and addReward
.
Below are the steps to exploit and the impact:
Any user calls the changeOwner
function with their own address or any address they control as the _newOwner
.
The user becomes the new owner of the contract.
The new owner can now call functions that are supposed to be restricted to the original owner, such as withdrawing all funds.
.
Manual Review
Implement access control by adding a require
statement to ensure that only the current owner can change the ownership. Modify the function as follows:
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.