Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Missing access control for `changeOwner` function

Summary

changeOwnerfunction has no access control and is callable by anyone.

function changeOwner(address _newOwner) public {
owner = _newOwner;
}

Vulnerability Details

By passing a new address _newOwnerto the function anyone can change the owner of the protocol.

Impact

As per the specifications and the implementation, the owner can set the price of boxes, add new rewards, and withdraw funds. All these are key aspects of the functionality, which when made accessible by a malicious user could lead to critical issues with the protocol as changing fees, depleting the protocol of its funds, etc.

PoC

The test snippet is already in the .t.sol file. Just run forge test --mt testChangeOwner.

Tools Used

Manual Review, Foundry

Recommendations

Implement access control to the function.

Updates

Appeal created

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Anyone can change owner

Support

FAQs

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