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

`s_password` content is accessible via blockchain inspection

Summary

The PasswordStore.sol contract has a vulnerability where the stored password can be directly read from the contract's storage on the Ethereum blockchain.

Vulnerability Details

The content of the s_password variable can be accessed directly without interacting with the contract's functions.

Exploit scenario:

Initial state:

  • The PasswordStore contract is deployed on the Ethereum network.

  • The owner has set a private password using the setPassword function.

Step 1: An attacker inspects the storage of the PasswordStore contract directly using the Foundry command

cast storage <ADDRESS> [SLOT]

or Web3

web3.eth.getStorageAt(address, position)

and reads the content of the s_password.

Outcome: The attacker successfully retrieves the password without using the contract's functions.

Impact

The core functionality of the contract, which is to store a password and prevent others from accessing it, is compromised.

Tools Used

Manual review

Recommendations

Do not store passwords directly on the blockchain.

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

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.