The s_password
value is accessible by everyone.
The s_password
variable is used to store the password. However everyone can get it's value despite being marked as private
and despite the getPassword
function having a check if the msg.sender
is the owner of the contract.
Everyone knows the password.
Manual Review, Foundry
There are 2 ways that we can get the s_password
value.
Read the setPassword
tx data.
Get the storage slot value.
setPassword
tx data.A user can simply check the tx data of the setPassword
and see what the new password is.
Everything on the blockchain is public and we can see all variables data by getting the slots they are stored in. To get the stored slot 1 in which the password is, type cast storage contractAddress 1
in the terminal. The result will be 0x6d7950617373776f726400000000000000000000000000000000000000000014
. If we take this part of the result: 6d7950617373776f7264
and put it in a Hex to String converter, we get myPassword
, which is the password the owner set.
Store the password off-chain.
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.