Gold NFT

Idea

Contract bytecode:

Decompile it:

Here is the pseudocode I got:

The read() function actually reads from a storage slot and that slot number comes from our input. In the end bool(STORAGE[varg0]) will cast the content in that storage slot to boolean, anything nonzero suffices. So our objective is to find out a non-zero storage slot.

The other function with selector 0x0daa5703 is a setter with access control: only address(3) can call it.

In etherscan we can find the "Contract Creation" tx 0x88fc0f1dd855405d092fc408c3311e7131477ec201f39344c4f002371c23f81c. A lesser-known feature is the "State" tab:

It shows the storage slot 0x23ee4bc3b6ce4736bb2c0004c972ddcbe5c9795964cdd6351dadba79a295f5fe was updated from 0 to 1 during creation:

This is just what we want, so the "password" is just 0x23ee4bc3b6ce4736bb2c0004c972ddcbe5c9795964cdd6351dadba79a295f5fe.

After that, notice _safeMint() has reentrancy problem, so the rest is easy.

PoC

Last updated