Anyone can set Password because function is external and lack access control
See Summary
Anyone can set password other than owner which is not safe for owner to store and retrieve password.
Here is the test written in foundry to test if anyone can set password.
Add this test in PasswordStore.t.sol and run forge test.
pranking as address(1)
which is not owner.
and Test passes as follows.
Foundry
Use modifiers like onlyOnwer or OpenZeppelin Ownable Library to implement OnlyOwner Modifier. i.e
modifier onlyOwner() external {
require (owner = msg.sender)
}
and implement it as follows in vulnerable function.
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.