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

`MondrianWallet::tokenURI(uint256 tokenId)` uses weak Cryptographic random number generator used to choose NFT artwork.

Description

The MondrainWallet is also an NFT and the protocol states:

You'll see the tokenURI function returns one of 4 random Mondrian art paintings. Each should have equal distribution and be random.

This invariant is broken due to the implementation of the MondrianWallet::tokenURI function.

  • The random artwork is chosen based on: tokenId modulus 10 which is not random.

  • The tokenId is user controlled and therefore the artwork for the NFT is predictable.

  • The distribution is not equal as the result of modulus operation favours the ART_FOUR NFT.

Impact

Core invariant does not hold true and a user may be able to mint and choose whichever NFT artwork they like.

Recommended mitigation

  • Use a purpose built, trusted and well-tested library for generating random numbers.

Tools Used

  • Manual Review

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

NFTs are not random

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.