Inverse Finance contest - cuteboiz's results

Rethink the way you borrow.

General Information

Platform: Code4rena

Start Date: 25/10/2022

Pot Size: $50,000 USDC

Total HM: 18

Participants: 127

Period: 5 days

Judge: 0xean

Total Solo HM: 9

Id: 175

League: ETH

Inverse Finance

Findings Distribution

Researcher Performance

Rank: 122/127

Findings: 1

Award: $0.38

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L82

Vulnerability details

Impact

Oracle.sol is calling latestAnswer to get the price. This 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.

According to Chainlink’s documentation (https://docs.chain.link/docs/price-feeds-api-reference/) the function latestAnswer has been deprecated, This function does not throw an error if no answer has been reached, but instead returns 0, causing an incorrect price to be fed.

Proof of Concept

// get price from feed uint price = feeds[token].feed.latestAnswer(); require(price > 0, "Invalid feed price");

Tools Used

Manually

Recommend using the latestRoundData function to get the price instead. Also recommend adding checks on the return data with proper revert messages if the price is stale or the round is incomplete, for example:

#0 - neumoxx

2022-10-31T08:52:18Z

Duplicate of #601

#1 - c4-judge

2022-11-05T17:54:03Z

0xean marked the issue as duplicate

#2 - Simon-Busch

2022-12-05T15:24:54Z

Issue marked as satisfactory as requested by 0xean

#3 - c4-judge

2022-12-07T08:14:13Z

Simon-Busch marked the issue as duplicate of #584

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