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

Password can be seen by anyone.

Summary

All data stored on the blockchain is public!

Vulnerability Details

POC:

function test_log_password() public {
vm.startPrank(owner);
string memory expectedPassword = "CyfrinIsGreat";
passwordStore.setPassword(expectedPassword);
bytes32 slotValue = vm.load(address(passwordStore),bytes32(uint256(1)));
console.logString(string(abi.encodePacked(slotValue)));
}

Impact

High as the password is visible to anyone and can be used for malitious purposes.

Tools Used

Foundry, Manual Review

Recommendations

Hash the password and store the hash instead.

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.