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

setPassword method can be accessed by anyone!

Summary

Basically anyone can set the password and overwrite the current one.

Vulnerability Details

POC:

function test_everyone_can_set_password() public {
string memory fakePassword = "fakePassword";
vm.prank(address(hAckEr));
passwordStore.setPassword(fakePassword);
vm.prank(owner);
string memory actualPassword = passwordStore.getPassword();
assertEq(actualPassword, fakePassword);
}

Impact

High as anyone can take advantage and change the password.

Tools Used

Foundry, Manula Review

Recommendations

Apply same check as in getPassword() method.

if (msg.sender != s_owner) {
revert PasswordStore__NotOwner();
}
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.