Closed sherlock-admin2 closed 9 months ago
1 comment(s) were left on this issue during the judging contest.
takarez commented:
valid because { valid and duplicate of 13}
The ERC4626 methods do not allow for slippage control via the input parameters. Slippage control must be performed by the caller by checking the tokens received. Direct slippage control from EOA can be accomplished using redeemToUnderlying
xiaoming90
high
maxImpliedRate
is hardcoded to zeroSummary
The slippage control (
maxImpliedRate
) was found to be hardcoded to zero. As a result, the trade will proceed even if the user suffers huge slippage, resulting in the user receiving less cash than expected (loss of cash).Vulnerability Detail
The
wfCashERC4626.withdraw
andwfCashERC4626.redeem
relies on the_redeemInternal
function to redeem the shares (wfCash). However, it was found that theRedeemOpts.maxImpliedRate
is hardcoded to zero.https://github.com/sherlock-audit/2023-12-notional-update-5/blob/main/wrapped-fcash/contracts/wfCashERC4626.sol#L262
Assume that the fCash has not matured yet and the wrapper account does not have any cash balance. As such, the
wfCashLogic._sellfCash
function will be executed, which in turn calls theNotionalV2.batchBalanceAndTradeAction
function. ThemaxImpliedRate
, which is set to zero, is used to set therateLimit
of the trade.After the trade is executed, there is an option to check the slippage if the
rateLimit
is not set to zero. This is to ensure that the trade does not incur excessive slippage beyond the user's acceptable limit. Since therateLimit
has been hardcoded to zero, the slippage control is effectively disabled.As a result, the trade will proceed even if the user suffers huge slippage, resulting in the user receiving less cash than expected (loss of cash).
Impact
The trade will proceed even if the user suffers huge slippage, resulting in the user receiving less cash than expected (loss of cash).
Code Snippet
https://github.com/sherlock-audit/2023-12-notional-update-5/blob/main/wrapped-fcash/contracts/wfCashERC4626.sol#L262
Tool used
Manual Review
Recommendation
Consider updating the
redeem
andwithdraw
functions to allow users to define the rate limit. If the changes are not possible due to the requirement to align with ERC4626 interfaces, consider documenting the risk that it is possible for the users to incur slippage during the trade when these functions are used.