In withdrawInternal,user will specify an amount of lp to withdraw from Ichi. The rest will be removed for loan repayment. However, after repaying the loan, the amountLpWithdrawn is not being withdrawn from IchiBank and hence the amount will stay in IchiVaultSpell where the next withdrawal can steal from.
Vulnerability Detail
Notice step 2, amtLPToRemove is based on the ichi vault liquidity balance that the position has minus the amountLpWithdraw. amtLPToRemove will be removed from IchiVault and after a swap a repayment of the loan will be done. Notice that no where in the code does the amountLpWithdrawn that stayed in the IchiVaultSpell gets withdrawn or sent back to user.
koxuan
high
amountLpWithdrawn not given back to user
Summary
In
withdrawInternal
,user will specify an amount of lp to withdraw from Ichi. The rest will be removed for loan repayment. However, after repaying the loan, theamountLpWithdrawn
is not being withdrawn from IchiBank and hence the amount will stay inIchiVaultSpell
where the next withdrawal can steal from.Vulnerability Detail
Notice step 2, amtLPToRemove is based on the ichi vault liquidity balance that the position has minus the amountLpWithdraw. amtLPToRemove will be removed from IchiVault and after a swap a repayment of the loan will be done. Notice that no where in the code does the
amountLpWithdrawn
that stayed in theIchiVaultSpell
gets withdrawn or sent back to user.Impact
Loss of fund to user who specified
amountLpWithdrawn
.Code Snippet)
IchiVaultSpell.sol#L276-L330
Tool used
Manual Review
Recommendation
Recommend sending back user the
amountLpWithdrawn
.Duplicate of #151