Closed sherlock-admin2 closed 9 months ago
1 comment(s) were left on this issue during the judging contest.
takarez commented:
valid because { This is valid and a dupp of 066; but the recommendation should be discarded and instead use the same amount or index used during requestWithdraw instead of recalculating it}
Varun_05
medium
Lack of slippage check when a user requests a withdraw in FundingRateArbitrage.sol
Summary
When a user requests a withdraw and when the withdrawal requests are permitted there can be decrease in the value of getIndex() which can cause a user to loss.
Vulnerability Detail
Following is request withdraw function
and following is permit withdraw requests
If in request withdraw function index is high then it can cause the value of the following to be very less
But when the request is fulfilled then index can be low due to which when the following is done
if index is low it further reduces the value of USDCAmount and it can also cause USDCAmount to be equal to feeAmount and thus no usdc would be transferred to the user. A scenario where index can reduce is lot of users request withdrawls or when jusd is borrowed after calculating index in the request withdraw function which decreases the net value but the total earn usdc amount remains the same
The above is valid because if there is large amount of withdrawls requests then all of them can not be executed in a single transaction.
Impact
Causes a loss to the users as they might not receive any usdc.
Code Snippet
https://github.com/sherlock-audit/2023-12-jojo-exchange-update/blob/main/smart-contract-EVM/src/FundingRateArbitrage.sol#L304
Tool used
Manual Review
Recommendation
Add a input in withdraw requests where the user defines the minimum value they want to receive.
Duplicate of #35