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

Everyone can read the password

Summary

Even though s_password is a private variable and getPassword can only be called by the owner, due to the nature of the blockchain anyone can still read the password.

Vulnerability Details

Theres multiple ways people can read the password of this contract.
First of all even though the s_password variable is private, there are no secret / private variables on the blockchain and people can still access them by reading the storage slots directly. In this case we just have to read from storage slot 1.

Another way of getting the password would simply be to check out the transactions on a block explorer like etherscan by checking the calldata of the latest setPassword() call

Impact

Anyone is able to read the 'secret' password, breaking the core functionality of the contract.

Tools Used

manual analysis

Recommendations

don't use smart contracts to store passwords

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.