Canto Identity Subprotocols contest - leopoldjoy'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: 44/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/main/canto-namespace-protocol/src/Tray.sol#L247

Vulnerability details

Impact

By manipulating the ordering of transactions in blocks, miners could manipulate the characterIndex values of a Tray's tiles. This could result in miners being able to specifically select characterIndex values that they want for specific Tray tiles, rather than truly random values.

Proof of Concept

Simply by altering the order of pending transactions into blocks, a miner who desires specific characterIndex values could manipulate them. When a user (or miner's address in this exploit) calls the buy() function of the Tray contract, it in turn repeatedly calls (for each tile) the _drawing function, providing uint256(lastHash) as input. The lastHash values is a variable stored in the state of the contract, and updated before each call. If these calls' order is changed, then the inputted lastHash values will vary. The _drawing() function in turn uses this inputted value towards the randomness generated by the call to Utils.iteratePRNG(_seed) here. The iteratePRNG is a simple on-chain PRNG function as you can see here. The characterIndex value is then set based on this randomness as you can see here, here and here.

Tools Used

Manual analysis.

Use of the Chainlink VRF oracle would prevent this vulnerability.

#0 - c4-judge

2023-03-28T18:47:44Z

0xleastwood marked the issue as duplicate of #121

#1 - c4-judge

2023-04-11T19:54:09Z

0xleastwood marked the issue as satisfactory

#2 - c4-judge

2023-04-11T20:03:27Z

0xleastwood marked the issue as duplicate of #121

#3 - c4-judge

2023-04-12T00:55:06Z

0xleastwood marked the issue as duplicate of #130

#4 - c4-judge

2023-04-12T00:59:59Z

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