Ondo Finance - 0xweb3boy's results

Institutional-Grade Finance, Now Onchain.

General Information

Platform: Code4rena

Start Date: 29/03/2024

Pot Size: $36,500 USDC

Total HM: 5

Participants: 72

Period: 5 days

Judge: 3docSec

Total Solo HM: 1

Id: 357

League: ETH

Ondo Finance

Findings Distribution

Researcher Performance

Rank: 56/72

Findings: 1

Award: $8.28

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2024-03-ondo-finance/blob/main/contracts/ousg/ousgInstantManager.sol#L307 https://github.com/code-423n4/2024-03-ondo-finance/blob/main/contracts/ousg/ousgInstantManager.sol#L399 https://github.com/code-423n4/2024-03-ondo-finance/blob/main/contracts/ousg/ousgInstantManager.sol#L479-L485

Vulnerability details

Impact

The mint and redeem function will revert in an edge case.

Proof of Concept

The _mint and the redeem function are internally calling the getOUSGPrice() function to retrieve the price of the OUSG and further mint the and redeem accordingly however getOUSGPrice() function is a view function used to get the price of OUSG from the oracle. There is a require condition which checks if price > MINIMUM_OUSG_PRICE and reverts accordingly.

function getOUSGPrice() public view returns (uint256 price) {
    (price, ) = oracle.getPriceData();
    require(
      price > MINIMUM_OUSG_PRICE,
      "OUSGInstantManager::getOUSGPrice: Price unexpectedly low"
    );
  }

The problem is getOUSGPrice() function isn't handling the case when price = MINIMUM_OUSG_PRICE and will revert in that case which is not ideal case. It should only revert in case of price < MINIMUM_OUSG_PRICE.

Tools Used

Manual review

Just replace

function getOUSGPrice() public view returns (uint256 price) {
    (price, ) = oracle.getPriceData();
    require(
-      price > MINIMUM_OUSG_PRICE,
+      price >= MINIMUM_OUSG_PRICE,
      "OUSGInstantManager::getOUSGPrice: Price unexpectedly low"
    );
  }

Assessed type

DoS

#0 - c4-pre-sort

2024-04-04T05:15:34Z

0xRobocop marked the issue as duplicate of #338

#1 - c4-judge

2024-04-09T09:25:56Z

3docSec changed the severity to QA (Quality Assurance)

#2 - c4-judge

2024-04-09T09:27:53Z

3docSec marked the issue as grade-b

#3 - 0xWeb3boy

2024-04-10T12:07:11Z

Hey, This issue is marked as a duplicate of #338 which is about sanity check and have not properly showed the impact. While this issue talks about how _mint and _redeem() will revert in an edge case where price == MINIMUM_OUSG_PRICE

#4 - 3docSec

2024-04-10T12:16:20Z

The sanity check failing does make other operations fail, so an availability impact is clear in #338 too. However QA is appropriate for both findings because oracle prices are manually set by the team, and if the protocol does not accept values equal to MINIMUM_OUSG_PRICE, they are expected to set at least MINIMUM_OUSG_PRICE + 1. Else, it would be their mistake - this is why a QA verdict is fair.

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