Closed sherlock-admin2 closed 1 year ago
Escalate
I do not consider this submission a duplicate of #519, which demonstrates an arithmetic underflow error rendering withdrawals impossible.
While this submission here highlights a slippage issue in https://github.com/sherlock-audit/2023-06-tokemak/blob/main/v2-core-audit-2023-07-14/src/vault/LMPVault.sol#L416-L418, reverting if the withdrawn assets are less than the anticipated withdrawal amount.
Escalate
I do not consider this submission a duplicate of #519, which demonstrates an arithmetic underflow error rendering withdrawals impossible.
While this submission here highlights a slippage issue in https://github.com/sherlock-audit/2023-06-tokemak/blob/main/v2-core-audit-2023-07-14/src/vault/LMPVault.sol#L416-L418, reverting if the withdrawn assets are less than the anticipated withdrawal amount.
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
This issue seems a dup of #450. withdraw
function will only work as written when there isn't any slippage. Users should use redeem
function to avoid reverting due to slippage of withdrawal.
Planning to accept escalation and duplicate with #450
Result: Invalid Duplicate of #450
Escalation is accepted even if issue is invalid as main issue was valid when the escalation was created.
Nyx
high
Hard-coded slippage may freeze user funds during market turbulence
Summary
If volatile market conditions happen, users can't withdraw their funds from the vault.
Vulnerability Detail
When the user withdraws, the user can use maxSharesOut parameter for slippage protection. There is one more slippage protection inside the withdrawing process.
If the actualAssests that returns from _withdraw() function is less than the user input assets parameter, the function will revert. If there are not enough idle funds in the LMPVault, the rest of the funds are withdrawn from Destination Vaults.
If one destination vault is not enough, funds are withdrawn from other destination vaults as well. (withdrawalQueue.length)
The problem is, let's say there are 3 destination vaults. (withdrawalQueue.length == 3) The volatile market condition happens, and funds coming from destination vaults are less than usual.(due to swaps) There is a chance that actualAssests won't equal user input assets parameter.
Because of too strict or hard-coded slippage, the user can't withdraw his funds and his funds are locked.
Impact
Users funds may be locked.
Code Snippet
https://github.com/sherlock-audit/2023-06-tokemak/blob/5d8e902ce33981a6506b1b5fb979a084602c6c9a/v2-core-audit-2023-07-14/src/vault/LMPVault.sol#L400-L419
https://github.com/sherlock-audit/2023-06-tokemak/blob/5d8e902ce33981a6506b1b5fb979a084602c6c9a/v2-core-audit-2023-07-14/src/vault/LMPVault.sol#L469-L480
Tool used
Manual Review
Recommendation
Pass a slippage parameter for the assets or remove the check.
Duplicate of #450