Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Anybody can set new password

Summary

In the comment of the setPassword function it is said that only the owner should be able to set the password, but there is no check for it.

Vulnerability Details

As anybody can set the password, it breaks the whole logic behind the protocol, which main purpose is to store the password of the only owner and only him be able to change it

Impact

Unpredictable behaviour

Tools Used

Manual Review

Recommendations

Check if the msg.sender is the owner and if no -> revert :

/*
* @notice This function allows only the owner to set a new password.
* @param newPassword The new password to set.
*/
function setPassword(string memory newPassword) external {
require(msg.sender == s_owner, "Should be owner");
s_password = newPassword;
emit SetNetPassword();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
about 2 years ago
inallhonesty Lead Judge about 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-lacking-access-control

Anyone can call `setPassword` and set a new password contrary to the intended purpose.

Support

FAQs

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