The MondrianWallet
documentation states,
You'll see the tokenURI function returns one of 4 random Mondrian art paintings. Each should have equal distribution and be random.
However, the tokenURI
function depends solely on the modNumber
, which is the result of tokenId % 10
. This operation divides tokenId
by 10 and returns the remainder. Since tokenId
is presumably unique for each token, the modNumber
will cycle through the values 0 through 9 in a predictable pattern.
In this code, if modNumber
is 0, it returns ART_ONE
, if modNumber is 1, it returns ART_TWO
, 2 -> ART_THREE
, and everything from 3 to 9 will be ART_FOUR
. After that the cycle will repeat for the next 10 tokens and so on.
Likelihood: HIGH
Impact: MEDIUM
Users are led to believe that the NFTs are randomly generated, but in reality, the metadata is predictable. This can lead to a loss of trust in the protocol and its incentive model.
The predictable nature of the tokenURI
function can be observed in the following code snippet (for the sake of the test I've added a mintNft
function to be able to mint multiple NFTs):
Manual review + Foundry
To ensure an equal chance of selecting each variation, the protocol needs to implement a truly random selection mechanism, such as using a random number generator or incorporating external randomness from an oracle.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.