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

Anyone can call `getPassword`

Summary

Anyone can call getPassword

Vulnerability Details

getPassword function returns the value of the variable s_password which is meant to be secret. Even though s_password can be read using web3 libraries. The if statement check for the msg.sender being equal to s_owner is not useful because the msg.sender can be set to anything by a malicious in case of call type transaction.

Impact

Anyone can read s_password using the getPassword function.

Tools Used

Manual

Recommendations

There is no gating msg.sender in case of view function and anyways that data can be read using web3 libraries, either store the data in a hashed form so people can read it but cannot make sense out of it or don't store password on-chain.

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 2 years ago
inallhonesty Lead Judge about 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.