Ondo Finance - 0xAkira'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: 40/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#L554-L560 https://github.com/code-423n4/2024-03-ondo-finance/blob/main/contracts/ousg/ousgInstantManager.sol#L567-L573

Vulnerability details

Impact

In functions setMintFee() and setRedeemFee() admin sets new commission for minting and redeeming respectively. The first check is that mintFee/redeemFee (old commission) should be less than 200, if this condition is not met, the corresponding error is called.

function setMintFee(
    uint256 _mintFee
  ) external override onlyRole(CONFIGURER_ROLE) {
    require(mintFee < 200, "OUSGInstantManager::setMintFee: Fee too high");
    emit MintFeeSet(mintFee, _mintFee);
    mintFee = _mintFee;
  }

  function setRedeemFee(
    uint256 _redeemFee
  ) external override onlyRole(CONFIGURER_ROLE) {
    require(redeemFee < 200, "OUSGInstantManager::setRedeemFee: Fee too high");
    emit RedeemFeeSet(redeemFee, _redeemFee);
    redeemFee = _redeemFee;
  }

But in these functions there is no check on the input data uint256 _mintFee/_redeemFee (new commission). If the admin sets _mintFee/_redeemFee >=200, he will not be able to use these functions and set new commissions in the future, because the condition will not be met.

The lack of the ability to set new commissions violates the functionality of the contract.

Proof of Concept

  1. PoC for setMintFee()
 function testSetMintFee() public {
    vm.startPrank(OUSG_GUARDIAN);

    ousgInstantManager.setMintFee(300);

    ousgInstantManager.setMintFee(100);
  }

A message is returned that the fee is too high

[FAIL. Reason: revert: OUSGInstantManager::setMintFee: Fee too high] testSetMintFee() (gas: 35732)
  1. PoC for setRedeemFee()
function testSetRedeemFee() public {
    vm.startPrank(OUSG_GUARDIAN);

    ousgInstantManager.setRedeemFee(300);

    ousgInstantManager.setRedeemFee(100);
  }

A message is returned that the fee is too high

[FAIL. Reason: revert: OUSGInstantManager::setRedeemFee: Fee too high] testSetRedeemFee() (gas: 35746)

Tools Used

forge

It is worth considering adding another check on the input data so that it is also less than 200

function setMintFee(
    uint256 _mintFee
  ) external override onlyRole(CONFIGURER_ROLE) {
+     require(mintFee < 200 && _mintFee < 200, "OUSGInstantManager::setMintFee: Fee too high");
    
    emit MintFeeSet(mintFee, _mintFee);
    mintFee = _mintFee;
  }

  function setRedeemFee(
    uint256 _redeemFee
  ) external override onlyRole(CONFIGURER_ROLE) {
+     require(redeemFee < 200 && _redeemFee < 200, "OUSGInstantManager::setRedeemFee: Fee too high");
    emit RedeemFeeSet(redeemFee, _redeemFee);
    redeemFee = _redeemFee;
  }

or simply replace mintFee/redeemFee with _mintFee/_redeemFee in the require()

function setMintFee(
    uint256 _mintFee
  ) external override onlyRole(CONFIGURER_ROLE) {
+     require(_mintFee < 200, "OUSGInstantManager::setMintFee: Fee too high");
    emit MintFeeSet(mintFee, _mintFee);
    mintFee = _mintFee;
  }

  function setRedeemFee(
    uint256 _redeemFee
  ) external override onlyRole(CONFIGURER_ROLE) {
+     require(_redeemFee < 200, "OUSGInstantManager::setRedeemFee: Fee too high");
    emit RedeemFeeSet(redeemFee, _redeemFee);
    redeemFee = _redeemFee;
  }

Assessed type

DoS

#0 - c4-pre-sort

2024-04-04T04:50:07Z

0xRobocop marked the issue as duplicate of #181

#1 - c4-judge

2024-04-09T14:51:56Z

3docSec changed the severity to QA (Quality Assurance)

#2 - c4-judge

2024-04-09T14:52:34Z

3docSec marked the issue as grade-b

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