Canto Identity Subprotocols contest - popular00's results

Subprotocols for Canto Identity Protocol.

General Information

Platform: Code4rena

Start Date: 17/03/2023

Pot Size: $36,500 USDC

Total HM: 10

Participants: 98

Period: 3 days

Judge: leastwood

Total Solo HM: 5

Id: 223

League: ETH

Canto Identity Subprotocols

Findings Distribution

Researcher Performance

Rank: 43/98

Findings: 1

Award: $39.87

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: juancito

Also found by: Chom, J4de, Ruhum, adriro, igingu, leopoldjoy, luxartvinsec, pipoca, popular00, reassor

Labels

bug
2 (Med Risk)
partial-50
duplicate-130

Awards

39.8657 USDC - $39.87

External Links

Lines of code

https://github.com/code-423n4/2023-03-canto-identity/blob/077372297fc419ea7688ab62cc3fd4e8f4e24e66/canto-namespace-protocol/src/Tray.sol#L163

Vulnerability details

Impact

Detailed description of the impact of this finding. The iteratePRNG() function in the Utils.sol library is used in Tray.sol:_drawing(), which is used to determine the tile data that a user gets when they purchase an NFT in Tray.sol:buy(). An attacker can exploit this to guarantee that they receive a rare/desirable mint.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

iteratePrng does not actually generate randomness, instead using the previous number to compute each new pseudo-random number. This allows an attacker to precompute any data that relies on this function.

Because the 'randomness' for the tile data in Tray.sol:buy() relies on iteratePRNG() (indirectly via _drawing()), An attacker can either 1) precompute the tile data and wait for a desirable lastHash before they buy, or 2) call buy() -> check the tile data -> revert if it's not desirable/rare. Both options guarantee that they receive an NFT with data/traits that they want.

This scenario is similar to the Wolf Game Exploit.

Tools Used

Manual review

  1. Employ a source of secure randomness, such as chainlink VRF (or PREVRANDAO - not sure if there is something like this on Canto)
  2. Commit-reveal (or other two-step solution), where the initial seed isn't made public until all users have minted

#0 - c4-judge

2023-03-28T18:48:31Z

0xleastwood marked the issue as duplicate of #121

#1 - c4-judge

2023-04-11T19:55:01Z

0xleastwood marked the issue as satisfactory

#2 - c4-judge

2023-04-11T20:03:26Z

0xleastwood marked the issue as duplicate of #121

#3 - c4-judge

2023-04-12T00:55:04Z

0xleastwood marked the issue as duplicate of #130

#4 - c4-judge

2023-04-12T00:59:55Z

0xleastwood marked the issue as partial-50

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter