Mystery Box

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

Anybody can become the owner and withdraw all the funds among other restricted actions

Summary

ChangeOwner function has no access control and can be called by anyone, hence anybody can become the owner and call sensitive functions that would allow them to manipulate rewards but most importantly withdraw all the funds.

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

Vulnerability Details

Impact


Critical, anybody can become the owner and hence be able to change the price, add rewards, and most importantly withdraw all the funds

function withdrawFunds() public {
require(msg.sender == owner, "Only owner can withdraw");
(bool success,) = payable(owner).call{value: address(this).balance}("");
require(success, "Transfer failed");
}

Tools Used

Manual review

Recommendations

Allow only the owner to change the owner (add a conditional revert so that function reverts if msg.sender is not the owner), and at best user Owner2Step to ensure safe ownership transfers

Updates

Appeal created

inallhonesty Lead Judge about 1 year 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.

Give us feedback!