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

Storing password in blockchain

Summary

The PasswordStore contract stores a private password, but it's important to note that in the blockchain, all data is inherently public and can be accessed and analyzed in various ways. This finding raises concerns about the security of storing sensitive information like passwords on the blockchain.

Vulnerability Details

The vulnerability lies in the fact that the contract stores a private password in a Solidity string variable (s_password). While the variable is marked as private, the nature of blockchain technology means that all data stored on the blockchain is accessible to anyone who knows where to look, even if it's marked as private in the contract. Blockchain explorers, data analysis tools, and anyone with access to the blockchain's data can potentially extract and analyze the password.

Impact

The impact of storing a private password on the blockchain is that it may expose sensitive information to potential adversaries. While the contract attempts to restrict access to the password, the inherent transparency of blockchain data can make it vulnerable to unauthorized access or analysis.

Tools Used

No tools used. It was discovered through manual inspection of the contract.

Recommendations

Considering the inherent transparency of blockchain data, it is recommended to reconsider the practice of storing sensitive information like passwords directly on the blockchain. Instead, it's advisable to explore alternative security measures, such as encryption, off-chain storage, or using blockchain for purposes other than storing private data.

Additionally, it's important to note that many of the other findings in the contract may lose relevance if the password is removed, as functions like setPassword and getPassword would no longer be needed. Therefore, addressing the issue of storing sensitive data should be a priority, and it may impact the overall design and functionality of the contract.

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.