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

Anyone can set a new password

Summary

Anyone can set a new password in the password store contract by calling setPassword() function.

Vulnerability Details

Since anyone can change the password. I think this function is highly vulnerable to attacks.

Impact

It has a very high impact on the contract such as data manipulation, since anyone can change the password as their wish.

Recommendations

Add a check to make sure that only owner of the contract can set the password if not then revert.

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.