Mystery Box

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

changeOwner() can be called by anyone

Summary

Anyone can call change owner, and then withdraw all funds

Vulnerability Details

  1. Malicious user call `changeOwner(maliciousAdress)`

  2. Malicious user call `withdrawFunds()`

Impact

Anyone can steal all Ether on the contract

Recommendations

Add a check so that only the owner can change the owner of the contract :

function changeOwner(address _newOwner) public {
+ require(msg.sender == owner, "Only owner can change owner");
owner = _newOwner;
}
Updates

Appeal created

inallhonesty Lead Judge 9 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.