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

No access control for setting password

Summary

Lack of access control for setPassword().

Vulnerability Details

setPassword() does not check for who the message sender is, therefore anyone can call this function and override the currently stored password.

Impact

Anyone can call setPassword() and override the password that the owner saved, causing the owner to lose his/her password.

Tools Used

Manual review

Recommendations

Add access control to setPassword(), change the function to:

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.