code-423n4 / 2023-03-canto-identity-findings

1 stars 1 forks source link

Namespace protoccol: trays are minted based on very easy to calculate pseudo-randomness #146

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-03-canto-identity/blob/main/canto-namespace-protocol/src/Tray.sol#L247 https://github.com/code-423n4/2023-03-canto-identity/blob/main/canto-namespace-protocol/src/Tray.sol#L266 https://github.com/code-423n4/2023-03-canto-identity/blob/main/canto-namespace-protocol/src/Utils.sol#L141

Vulnerability details

[M-02] Namespace protoccol: trays are minted based on very easy to calculate pseudo-randomness

In Namespace protocol, a Namespace NFT is created from fusing trays, which are NFTs holding 7 characters. Trays are minted based on an open, easy to predict pseudo-random-number-generator, implemented as iteratePRNG. Each tray can contain characters from 10 different font classes, with probabilities for each font class ranging from 32/109 to 1/109. This means that characters belonging to super rare font classes will be considerably more scarce, and so a lot more valuable.

Using a pseudo-random-number-generator means one can predict what tray they will get before minting, with a lot of ease.

Impact:

The impact is three-fold, first two being more dangerous to normal users (sniping and front-running):

Remediation:

Use Chainlink's Verified Random Function to generate truly random numbers. If implemented correctly, integrating Chainlink VRF won't have possibility of predicting future tray, sniping or front-running.

c4-judge commented 1 year ago

0xleastwood marked the issue as duplicate of #121

c4-judge commented 1 year ago

0xleastwood marked the issue as satisfactory

c4-judge commented 1 year ago

0xleastwood marked the issue as duplicate of #121

c4-judge commented 1 year ago

0xleastwood marked the issue as duplicate of #130

c4-judge commented 1 year ago

0xleastwood marked the issue as partial-50