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

PasswordStore.sol#setPassword - Any one can set a password

Summary

According to the comments

/*
* @notice This function allows only the owner to set a new password.
* @param newPassword The new password to set.
*/

This function should only be called by the owner

Vulnerability Details

There's no check for owner address

Impact

Any one can set the password which will erase the previous password stored in the contract causing a likely loss to the owner

Tools Used

Manual Review

Recommendations

rewrite the function like this

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.