Mystery Box

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

Missing check for access control for changing owner

Vulnerability Details

As a owner, maybe we want to change the ownership. But in this code , there is no action for checking the msg.sender. whether msg.sender is the owner?

function changeOwner(address _newOwner) public {
// @audit-high missing access control to change owner
owner = _newOwner;
}

Impact

Every users can change the owner whenever they want

Tools Used

Manual review

Recommendations

Add the checking action to ensure only the owner can change the ownership.

function changeOwner(address _newOwner) public {
+ require(msg.sender == owner, "msg.sender isn't owner!");
owner = _newOwner;
}
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!