Ethereum smart contract code, storage, and any data transacted on-chain can always be read. Treat it as such. Even if your code is not verified , attackers can still decompile or check transactions to and from it to analyze it. For this reason, it's imperative that private data is never stored on-chain unencrypted.
PasswordStore stores unencrypted password so an attacker (using a blockchain explorer or node) could query the variable storage storage slot to retrieve the password in hexadecimal format.
The vulnerability occurs due to the false assumption that if a variable is marked as private then no one could read it and because the password is stored in clear text
Add the following function in provided test file PasswordStore.t.sol:
Run the test with verbose option:
Observe the password is retrieved in hexadecimal format
Anyone could read the contract sensitive password
Manual analysis
Encrypt the password using EOA private key before storing to the blockchain
https://consensys.github.io/smart-contract-best-practices/development-recommendations/general/public-data
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.