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

Dangerous to store sensitive info onchain

Summary

It is dangerous to store sensitive information on chain.

Vulnerability Details

The contract store sensitive info(password) on chain which can be got by malicious party by multiple ways:

  1. query/decode setPassword transaction

  2. query storage, for example:

function test_read_password() public {
vm.startPrank(owner);
string memory expectedPassword = "myNewPassword";
passwordStore.setPassword(expectedPassword);
string memory actualPassword = passwordStore.getPassword();
assertEq(actualPassword, expectedPassword);
bytes32 passFromStore = vm.load(address(passwordStore), bytes32(uint256(1))); // slot 1
console.log(string(abi.encodePacked(passFromStore)));
}

Impact

Sensitive information leak.

Tools Used

Manual, Foundry

Recommendations

Try not store sensitive info onchain

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.