The contract is designed to let only the owner to store a private password but currently the setPassword
function doesn't have any access control, enabling anyone to overwrite it.
The setPassword
function doesn't have any checks looking to see if the caller is the owner of the contract. This makes it so that anyone could call this function and are able to set the password.
Proof of concept:
Deploy the contract using Account1 as the owner.
The owner then calls the setPassword
and set a new password.
Switch to the attackers side Account2.
Call the setPassword
function using Account2 and set a new password.
The results should be the password set by the attacker proving the issue at hand.
The impact of this vulnerability is high and the likelihood is high as well.
Manual Review
Implementing a check to see if the caller is the contract owner should be implemented such as:
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.