The PasswordStore :: setPassword
function lack of an ownership check
This function is designed to permit only the contract's owner to establish a new password. However, the absence of access control within this function fails to verify if the caller is indeed the owner.
Consequently, any address can invoke this function and modify the password.
This test will pass, demonstrating the security flaw
this vulnerability could lead to a complete loss of control over the contract for the legitimate owner, unauthorized access to contract-controlled resources, and exposure of sensitive data.
-Foundry
-Manual Review
You should add a modifier that checks if the message sender is the owner of the contract. If not, the function should revert. Here's how you can implement this:
This way, only the owner of the contract can set a new password, preventing unauthorized access.
You can also use this modifier to the PasswordStore::getPassword
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.