A user that is not the owner can set a new password when they shouldn’t be able to.
Line #23 specifies that @notice This function allows only the owner to set a new password. but
setPassword function lacks any owner checks as shown above.
Test done to prove that a non owner user can set a new password is shown below:
when forge test is used in the terminal our test passes which shows that a user that is not the owner can set a new password.
Only the owner of the contract should be able to set a new password but this vulnerability shows that anyone can set a new password and change the password that owner has set which defeats the purpose of this contract as the owner won’t be able to access the password that they have set.
Manual review and Foundry
Update the setPassword function with an if check as shown below:
.
Anyone can call `setPassword` and set a new password contrary to the intended purpose.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.