Writeups/Ethernaut/Vault
EasyEthernaut · Ethernaut2024

Vault

Private Variable Readable via eth_getStorageAt

`private` only blocks Solidity-level access. The password stored in slot 1 is readable by anyone using `eth_getStorageAt`. Submitting it to `unlock()` clears the `locked` flag.

SolidityStorage Slotseth_getStorageAtPrivate Variables

00Overview

`private` only blocks Solidity-level access. The password stored in slot 1 is readable by anyone using `eth_getStorageAt`. Submitting it to `unlock()` clears the `locked` flag.

01Read the password from storage

javascript
await web3.eth.getStorageAt(instance, 1)
// Returns the 32-byte password

02Unlock the vault

javascript
await contract.unlock(password)

03Level Completed

Vault — completion screenshot 1