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

Missing permission check in setPassword() function

Summary

Anyone can call the setPassword function to change the s_password value.

Vulnerability Details

This setPassword function is intended to be only called by the owner. As the comment stated that:

"This function allows only the owner to set a new password".

However, there is no owner validation like the getPassword() function does.

Impact

Missing access control which puts the s_password in danger of being changed by anyone.

Tools Used

Manual Analyis

Recommendations

Consider adding the validation into setPassword function like below:

function setPassword(string memory newPassword) external {
+ if (msg.sender != s_owner) {
+ revert PasswordStore__NotOwner();
+ }
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.