The setPassword function in the PasswordStore contract lacks an onlyOwner access control mechanism. This absence means any address can call this function and change the password, posing a security risk.
In the current implementation of the setPassword function, there is no check to ensure that the caller is the owner (stored in the s_owner variable) of the contract. Without this check, any user can call this function and potentially alter the state of a critical variable in the contract, which is the s_password.
If malicious actors identify this vulnerability, they could continuously change the password, making the original intent of the contract (a secure place for the owner's password) useless and potentially disrupting the contract's normal operation.
An unauthorized address could interact with the contract as follows:
・foundry
Implement an onlyOwner access control check in the setPassword function. This check ensures that only the owner can update the password stored in the contract.
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.