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

Sensitive data (password) is passed visibly to everyone

Summary

TX call data is readable for everyone, so anyone will be able to read the password set by owner

Vulnerability Details

TX data is readable by anyone, and function call arguments can be extracted, exposing the sensitive password value.
E.g. it can be done like that:

const store = await ethers.deployContract('PasswordStore');
const tx = await store.setPassword("password");
console.log(store.interface.decodeFunctionData('setPassword', tx.data))

Impact

High

Tools Used

Hardhat

Recommendations

Combined with all the previous reports, probably, just go rugpull, because it will be fully pwned in 5 minutes after release anyway.

However, if this contract really needs to work like it is described, and assuming this is intended to be used by some web2 system that accepts passwords, then better to store not a password, but encrypted value of structure like encode(consumer_publicKey, [password, owner_address]). This will both allow to check the password on web2 side while keeping it private. However, it will be still vulnerable to attack via rainbow tables, which can be prevented with usage of user's signature, so output will be something like encode(consumer_publicKey, [password, owner_address, sign(owner_privateKey, [password, owner_address])]). Extra actions can be taken to fight the signature replay attacks, but this depends a lot on real world application of this contract.

Updates

Lead Judging Commences

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

merklebonsai Submitter
about 2 years ago
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.