Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

getPassword - private variables are lookupable by anyone, so password is not secret

Summary

private variables can be read by anyone

Vulnerability Details

In the getPassword function, it restricts access so that only owner can retrieve the password.

function getPassword() external view returns (string memory) {
@> if (msg.sender != s_owner) {
@> revert PasswordStore__NotOwner();
}
return s_password;
}

However, even though the variable in the contract is private, the value at blockchain is public. So, anyone other than the owner can retrieve it.

Impact

Anyone can read password value.

Tools Used

Manual Review

Recommendations

Do not store secret data in the contract.

Updates

Lead Judging Commences

inallhonesty Lead Judge
almost 2 years ago
inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-anyone-can-read-storage

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

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.