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

Exposure of Private Variables in PasswordStore Smart Contract

Summary

The PasswordStore smart contract, which is designed to store a user's private password, has a critical vulnerability. The s_password and s_owner variables, which are marked as private, can be read by anyone directly from the contract's memory data.

Vulnerability Details

In Solidity, the private access specifier only restricts other contracts from accessing a variable, but it doesn't encrypt or hide the variable's value from the Ethereum state. Consequently, any Ethereum user or node can read this information directly from the Ethereum state data.

For the PasswordStore contract:

  • s_password: Stores the user's password.

  • s_owner: Stores the address of the owner of the contract.

Both of these critical pieces of data are exposed, making them visible to anyone who queries the contract's state.

Impact

Any malicious actor or curious individual can easily obtain the password and the owner's address. This defeats the purpose of the contract, which is to keep the password private. It compromises the integrity and security of the users who rely on this contract.

Tools Used

No specialized tools are needed. The Ethereum state can be queried using standard Ethereum libraries like web3.js, ethers.js, or even by directly accessing an Ethereum node.
Here is another interesting online tool evm.storage

Recommendations

  1. Consider not storing sensitive data, like passwords, directly on the blockchain due to its transparent nature. If necessary, use cryptographic methods like hashing or encryption before storing.

  2. Educate users about the transparent nature of blockchain and its implications on privacy.

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.