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

Anyone can set the password using ``setPassword()`` function.

Summary

Anyone can set new password using setPassword() function but that shouldn't be the case.

Vulnerability Details

Only owner who deployed this contract should be able to set new password but anyone can call setPassword() function to set new password.

Impact

Malicious user can set the password to random which will grief the owner as the owner will retrieve incorrect password.

Tools Used

Manual Analysis

Recommendations

Add proper access control to the setPassword() function like:

./PasswordStore.sol
26. 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.