Inadequate Handling of BUIDL Redemption Limit in OUSG Instant Manager
mediumLines of code
https://github.com/code-423n4/2024-03-ondo-finance/blob/78779c30bebfd46e6f416b03066c55d587e8b30b/contracts/ousg/ousgInstantManager.sol#L426-L429 https://github.com/code-423n4/2024-03-ondo-finance/blob/78779c30bebfd46e6f416b03066c55d587e8b30b/contracts/ousg/ousgInstantManager.sol#L460
Vulnerability details
Impact
The OUSG Instant Redemption Manager contract contains an oversight in its redeem function, specifically in the handling of BUIDL redemption limits. This oversight can potentially lead to failed redemption attempts when the redemption balance exceeds the BUIDL balance held by the manager contract while it has a right amount if its concatenated with USDC amount left by another redemption process. The impact of this issue is significant as it affects the usability of the redemption feature and can result in user frustration and loss of trust in the system.
Proof of Concept
The following Proof of Concept (POC) demonstrates the issue, use it as part of forge-tests/ousg/OUSGInstantManager/redeem.t.sol file:
Run using this command
bashnpm run test-forge -- --match-test test_POC_reddem_fail_when_alice_redeemtion_balance_is_over_manager_BUIDL_balance
solidityfunction test_POC_reddem_fail_when_alice_redeemtion_balance_is_over_manager_BUIDL_balance() public setupSecuritize(500_000e6, 500_000e6) { uint256 aliceOUSGRedeemAmount = 1667e18; uint256 aliceUSDCAmount = 250_100e6; uint256 bobOUSGRedeemAmount = 1666e18; uint256 bobUSDCAmount = 249_900e6; // Mint OUSG tokens for Alice and Bob vm.prank(address(ousgInstantManager)); ousg.mint(alice, aliceOUSGRedeemAmount); vm.prank(address(ousgInstantManager)); ousg.mint(bob, bobOUSGRedeemAmount); // Bob redeems OUSG tokens successfully vm.startPrank(bob); ousg.approve(address(ousgInstantManager), (bobOUSGRedeemAmount)); ousgInstantManager.redeem(bobOUSGRedeemAmount); vm.stopPrank(); // Alice attempts to redeem OUSG tokens, but the redemption fails due to insufficient BUIDL balance vm.startPrank(alice); ousg.approve(address(ousgInstantManager), (aliceOUSGRedeemAmount)); vm.expectRevert('Not enough tokens'); ousgInstantManager.redeem(aliceOUSGRedeemAmount); vm.stopPrank(); assertEq(USDC.balanceOf(bob), bobUSDCAmount); assertEq( BUIDL.balanceOf(address(ousgInstantManager)) + USDC.balanceOf(address(ousgInstantManager)), aliceUSDCAmount ); // However if Alice try to reddem an amount that will be in usdc amount <= minBUIDLRedeemAmount in ousgInstantManager it will success vm.startPrank(alice); ousgInstantManager.redeem(aliceOUSGRedeemAmount - 10e18); vm.stopPrank(); // Tokens remaining in Alice's balance after successful redemption assertEq(ousg.balanceOf(alice), 10e18); }
Tools Used
- Manual review
- Foundry
Recommended Mitigation Steps
To address this issue, the OUSG Instant Redemption Manager contract should implement a mechanism to ensure that redemption requests do not exceed the available BUIDL balance held by the manager contract. This can be achieved by incorporating proper checks and balances in the redemption process, such as verifying the BUIDL balance before processing redemption requests and adjusting the redemption amount accordingly. Additionally, consider an redeem implementation that concatenate the balance of remaining USDC amount with the BUIDL redeemed balance if the corresponding USDC amount or redeem amount of OUSG is more than minBUIDLRedeemAmount.
Assessed type
Error
