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

Anyone can change the password

Summary

Anyone can change the password by calling the function PasswordStore.sol/setPassword(string memory newPassword).

Vulnerability Details

The function setPassword(string memory newPassword) has no code for access control for only owner to set the new password.

Impact

The password is changed and the information stored by the owner is lost.

Tools Used

Manual Review

Recommendations

The function should also contain the code for validating the msg.sender.

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.