The PasswordStore.sol contract has a vulnerability where the stored password can be directly read from the contract's storage on the Ethereum blockchain.
The content of the s_password variable can be accessed directly without interacting with the contract's functions.
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.
The core functionality of the contract, which is to store a password and prevent others from accessing it, is compromised.
Manual review
Do not store passwords directly on the blockchain.
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
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.