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

setPassword function allows everyone use it

Summary

The PasswordStore::setPassword function should only be used by the contract owner, but for now, any user can use it.

Vulnerability Details

if the The PasswordStore::setPassword function doesn't validate if the msg.sender == owner any kind of user will be able to set a new password.

Impact

Any kind of user would be able to set a new password.

Tools Used

Foundry

Recommendations

Can be possible to use the same owner validation like the getPassword function.

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
almost 2 years ago
inallhonesty Lead Judge almost 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.