As it is possible to read the storage of contracts even in private variables, anyone is able to read the current password saved in this storage variable:
Also, the transactions from the get and set function calls are public in a block explorer and can be used to read the password. Therefore, it does not make sense at all to save a password on chain.
Also, the setPassword function misses a check if the msg.sender equals the owner and therefore anyone is able to change the password.
The following POC shows that anyone can change the password:
Anyone can see and change the password
Manual Review
Do not save passwords on chain, and restrict the setPassword function to be only callable by the owner. As this check will then appear in two functions, best practice would be to put it into a modifier.
Anyone can call `setPassword` and set a new password contrary to the intended purpose.
Private functions and state variables are only visible for the contract they are defined in and not in derived contracts. In this case private doesn't mean secret/confidential
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.