The PasswordStore
contract in the current project has a critical security vulnerability related to owner spoofing. A user can potentially compromise the initial owner (the contract creator) using a spoofing technique, particularly through the setPassword()
function.
In the setPassword()
function, there are no checks to verify whether the caller is the initial owner (the contract creator) or not. This leads to the possibility of a user changing the owner by deploying a new contract and then using the setPassword()
function to change the owner to the address of the new contract.
This vulnerability could result in the loss of the initial owner's sole control. An attacker could gain control or modify data within the contract, depending on their intentions.
Manual Review
To mitigate this vulnerability, it is essential to add a check to ensure that only the initial owner is allowed to change the password. Specifically, you can use a check within the setPassword()
function to compare msg.sender
with s_owner
before allowing the change to take place.
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.