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

The storage variable s_password can be viewed by everyone

Summary

The storage variable s_password that is supposed to be kept private just for the owner can be obtained by everyone

Vulnerability Details

Declaring a storage variable as private just means that only the smart contract can get this data ON-CHAIN. However, everyone can get the value of all storage variables of all deployed smart contract just by knowing the contract address and the storage slot where the variable is stored.

Impact

High, sensible data leakage

Tools Used

Manual Review

Recommendations

Sensible data can not be stored directly into the blockchain. Probably the best recommendation to store private data on-chain is by hashing the data and storing the hash. Then once the data is needed to be obtained/checked, the user has to compare if his guess for the password being hashed matches the stored hashm if it does, this is the password, if not no.

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.