Wild Credit contest - 0xRajeev's results

Decentralized lending protocol with isolated lending pairs.

General Information

Platform: Code4rena

Start Date: 23/09/2021

Pot Size: $50,000 USDC

Total HM: 5

Participants: 14

Period: 7 days

Judge: ghoulsol

Total Solo HM: 3

Id: 32

League: ETH

Wild Credit

Findings Distribution

Researcher Performance

Rank: 3/14

Findings: 4

Award: $10,356.99

๐ŸŒŸ Selected for report: 15

๐Ÿš€ Solo Findings: 0

Findings Information

๐ŸŒŸ Selected for report: 0xRajeev

Also found by: WatchPug

Labels

bug
3 (High Risk)
sponsor-confirmed

Awards

5947.4124 USDC - $5,947.41

External Links

Handle

0xRajeev

Vulnerability details

Impact

In _supplyCreditUni(), the last argument of _convertTokenValues() on L674 being _priceB instead of _priceA in the calculation of supplyB is a typo (should be _priceA) and therefore miscalculates supplyB, creditB, creditUni and therefore totalAccountSupply in function accountHealth() which affects the health of account/protocol determination that is used across all borrows/withdrawals/transfers/liquidations in the protocol. This miscalculation significantly affects all calculations in protocol and could therefore cause protocol insolvency.

Proof of Concept

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L674

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L340

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L398-L401

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L532

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L544

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L119

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L266

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L289

Tools Used

Manual Analysis

Change the last argument of _convertTokenValues() from _priceB to _priceA on L674.

Findings Information

๐ŸŒŸ Selected for report: 0xRajeev

Also found by: cmichel, leastwood

Labels

bug
2 (Med Risk)
sponsor-acknowledged

Awards

1070.5342 USDC - $1,070.53

External Links

Handle

0xRajeev

Vulnerability details

Impact

The contract uses Chainlinkโ€™s deprecated API latestAnswer(). Such functions might suddenly stop working if Chainlink stopped supporting deprecated APIs.

Impact: Deprecated API stops working. Prices cannot be obtained. Protocol stops and contracts have to be redeployed.

See similar Low-severity finding L11 from OpenZeppelin's Audit of Opyn Gamma Protocol: https://blog.openzeppelin.com/opyn-gamma-protocol-audit/

This was a Medium-severity finding even in the previous version of WildCredit contest as well: https://github.com/code-423n4/2021-07-wildcredit-findings/issues/75 where it was reported that "latestAnswer method will return the last value, but you wonโ€™t be able to check if the data is fresh. On the other hand, calling the methodย latestRoundDataย allow you to run some extra validationsโ€

Proof of Concept

https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/UniswapV3Oracle.sol#L101

See https://docs.chain.link/docs/deprecated-aggregatorinterface-api-reference/#latestanswer.

Tools Used

Manual Analysis

Use V3 interface functions: https://docs.chain.link/docs/price-feeds-api-reference/

#0 - talegift

2021-10-01T12:53:25Z

We'll remove dependence on Chainlink completely.

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