Redeemers will receive less collateral than expected if function completeRedemptions()
is called with empty refundees
list
#312
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-325
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2023-01-ondo/blob/f3426e5b6b4561e09460b2e6471eb694efdd6c70/contracts/cash/CashManager.sol#L720
Vulnerability details
Impact
Function
completeRedemptions()
is used by admin account to distribute collateral to users and also to refund redemption requests if the redemption cannot be serviced.Since in each epoch there might be many users send redemption requests, so to avoid breaking block gas limit, sponsor confirmed that each epoch will require multiple calls to function
completeRedemptions()
withcollateralAmountToDist
stay constant in every call.If function
completeRedemptions()
is called with emptyrefundees
in any TX, every redeemers in that call will receive less collateral back than expectedProof of Concept
Consider the scenario
100, 100
. SototalBurned = 200
.fees = 0
completeRedemptions([], [Bob], 100, X, 0)
first to process all refuding. Bob will be minted100
CASH back.completeRedemptions([Alice], [], 100, X, 0)
, in this calls, becauserefundees
list is empty, soquantityBurned
will be calculated wronglyquantityBurned = totalBurned - 0 = 200 amountToDist = 100 Alice_received = (100 * 100 / 200) = 50
So Alice only receive 50 instead of 100 collateral token back.
Tools Used
Manual Review
Recommended Mitigation Steps
Consider adding a
totalRefundAmt
input param instead of calculating it using function_processRefund()
in every callThe text was updated successfully, but these errors were encountered: