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

Missing access control on `setPassword`

Summary

Missing validation/access control on setPassword function.

Vulnerability Details

There is no validation on the setPassword's caller, as a result anyone can set the password for this password store.

Impact

The password can be set by any value by anyone:

function test_free_set_password() public {
vm.prank(address(0x123));
string memory expectedPassword = "hackerPassword";
passwordStore.setPassword(expectedPassword);
vm.prank(owner);
string memory actualPassword = passwordStore.getPassword();
assertEq(actualPassword, expectedPassword);
}

Tools Used

Manual, Foundry

Recommendations

Recommend adding access control to the setPassword function.

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.