The PasswordStore::setPassword
function is intended to be executed by only the owner of the protocol, but there are no checks implemented in place in the function's code to ensure this requirement.
Following is the vulnerable piece of code in the PasswordStore::setPassword
function :
Even though the comments in the code specify that This function allows only the owner to set a new password
, there are no checks in place to check whether the user executing this function is actually the owner.
Hence a non-owner attacker can just simply execute this function to change the s_password
value stored on the protocol.
Attacker: Any non-owner malicious actor on the network.
Victim: Owner of the PasswordStore protocol.
Protocol: PasswordStore is meant to allow only the owner to store and retrieve their password securely.
Write and run the following test case in the PasswordStore.t.sol
test file.
This vulnerability grants unauthorized access to any malicious actor on the network to change the Owner's password stored on the PasswordStore protocol. This compromises the integrity of data stored on the protocol.
Foundry
Implement an if
condition to check whether msg.sender
is the owner of the protocol :
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.