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

"s_password" meant to be secret can be viewed by anyone on-chain

Summary

The contract uses "s_password" to store the secret password. However, it supposes that "private" is enough to keep it secret, but anyone can analyze on-chain the storage and retrieve the secret password.

Vulnerability Details

The only meaningful difference between a public and private variable is that a public variable has a "getter" function to anyone retrieve it's value easily. A private variable is still retriable, the attacker just need to analyze the storage of the smart contract, which would be slot 1 in case of "s_password". So, the secret password is actually visible for anyone.

Impact

Any user can retrieve the secret password via smart contract storage review.

Tools Used

Manual Review

Recommendations

Never store sensitive data on-chain. If you really want, at least try to store in as a hash (and the input need to be a hash too).

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.