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

Storing the password directly in the ``s_password`` variable

Summary

The PasswordStore contract stores the user's password directly in the s_password variable, creating a serious security vulnerability.

Vulnerability Details

In the PasswordStore contract, the user's password is stored directly in the s_password variable. This creates a serious security vulnerability because the password becomes easily accessible to unauthorized parties. Typical contracts should use secure methods such as hashing the password before storing it to ensure user privacy and security.

Impact

This issue has a high impact on the security of the contract. Storing the password directly in the s_password variable makes the password easily discoverable and potentially accessible by anyone with access to the contract.

Tools Used

Manual Review

Recommendations

To fix this issue, should change the way the password is stored. Instead of storing the password directly, use a password hashing function before storing it in the s_password variable. Consider using a secure hashing library such as keccak256 to protect the user's password from unauthorized access. This will enhance security and protect user passwords from exposure within the contract.

function setPassword(string memory newPassword) external {
s_password = keccak256(abi.encodePacked(newPassword));;
emit SetNetPassword();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other
inallhonesty Lead Judge over 1 year 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.