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
Rank: 40/72
Findings: 1
Award: $8.28
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: immeas
Also found by: 0xAkira, 0xCiphky, 0xGreyWolf, 0xJaeger, 0xMosh, 0xabhay, 0xlemon, 0xmystery, 0xweb3boy, Aamir, Abdessamed, Aymen0909, Breeje, DanielArmstrong, DarkTower, Dots, EaglesSecurity, FastChecker, HChang26, Honour, IceBear, JC, K42, Krace, MaslarovK, Omik, OxTenma, SAQ, Shubham, Stormreckson, Tigerfrake, Tychai0s, VAD37, ZanyBonzy, albahaca, arnie, ast3ros, asui, b0g0, bareli, baz1ka, btk, caglankaan, carrotsmuggler, cheatc0d3, dd0x7e8, grearlake, igbinosuneric, jaydhales, kaden, kartik_giri_47538, m4ttm, ni8mare, niser93, nonn_ac, oualidpro, pfapostol, pkqs90, popeye, radev_sw, samuraii77, slvDev, zabihullahazadzoi
8.2807 USDC - $8.28
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
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.
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)
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)
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; }
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