✅Vault
private state variable
Description
Unlock the vault to pass the level!
Code Audit
Take a look at bytes32 private password
. The keyword private
in Solidity can be misleading: although it is meant to be "private", everything is indeed public on the blockchain. The private
only means "other contracts are not allowed to read it".
Solution
The state variable password
is located in storage #1 (#0 is the state variable locked
). Grab it from the challenge contract storage:
Unlock the vault with the password (in hex format) you just obtained:
Verify that the vault is now unlocked:
This should return false
.
Click "Submit instance" and move on to the next level.
Summary
It's important to remember that marking a variable as private only prevents other contracts from accessing it. State variables marked as private and local variables are still publicly accessible.
To ensure that data is private, it needs to be encrypted before being put onto the blockchain. In this scenario, the decryption key should never be sent on-chain, as it will then be visible to anyone who looks for it. zk-SNARKs provide a way to determine whether someone possesses a secret parameter, without ever having to reveal the parameter.
Last updated