Based Loans contest - shw's results

Compound's degenerate brother

General Information

Platform: Code4rena

Start Date: 29/04/2021

Pot Size: $30,000 USDC

Total HM: 3

Participants: 6

Period: 6 days

Judge: cemozer

Total Solo HM: 2

Id: 7

League: ETH

Based Loans

Findings Distribution

Researcher Performance

Rank: 3/6

Findings: 3

Award: $5,892.87

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: pauliax

Also found by: shw

Labels

bug
duplicate
disagree with severity
3 (High Risk)
sponsor confirmed

Awards

6696.4286 BLO - $1,339.29

4017.8571 USDC - $4,017.86

External Links

Handle

shw

Vulnerability details

Impact

In the file UniswapOracle/UniswapConfig.sol, the return value (i.e., index) of the three functions (getSymbolHashIndex, getCTokenIndex, and getUnderlyingIndex) are compared to the constant uint(-1) to check whether the cToken/underlying asset exists or not. However, index should be compared to 0 instead, since the returned value of these three functions has a default value of 0 (the default value of a mapping). The incorrect comparison treats non-existing cTokens/underlying assets as the token with index 0 and leads to unexpected results.

Proof of Concept

Referenced code: UniswapConfig.sol#L92 UniswapConfig.sol#L107 UniswapConfig.sol#L121 UniswapConfig.sol#L53-L63

Tools Used

None

Change uint(-1) to 0 at line 92, 107, and 121 in UniswapOracle/UniswapConfig.sol.

#0 - ghoul-sol

2021-05-08T19:07:59Z

It's a high risk issue. Duplicate of #24

#1 - ghoul-sol

2021-05-08T21:06:42Z

UniswapConfig has been refactored. Index 0 is considered a non-existent config and all comparison are against that value.

#2 - cemozerr

2021-05-12T18:51:20Z

Closing as it is a duplicate.

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