58491 sc high mytsharesdeposited not reduced on liquidation leading to deposit cap bypass and potential insovency
Description
Brief/Intro
Vulnerability Details
function _doLiquidation(uint256 accountId, uint256 collateralInUnderlying, uint256 repaidAmountInYield)
internal
returns (uint256 amountLiquidated, uint256 feeInYield, uint256 feeInUnderlying)
{
---
amountLiquidated = convertDebtTokensToYield(liquidationAmount);
feeInYield = convertDebtTokensToYield(baseFee);
// update user balance and debt
@>1 account.collateralBalance = account.collateralBalance > amountLiquidated ? account.collateralBalance - amountLiquidated : 0;
_subDebt(accountId, debtToBurn);
---
}
function _forceRepay(uint256 accountId, uint256 amount) internal returns (uint256) {
---
creditToYield = creditToYield > account.collateralBalance ? account.collateralBalance : creditToYield;
@2> account.collateralBalance -= creditToYield;
if (account.collateralBalance > protocolFeeTotal) {
@3> account.collateralBalance -= protocolFeeTotal;
// Transfer the protocol fee to the protocol fee receiver
TokenUtils.safeTransfer(myt, protocolFeeReceiver, protocolFeeTotal);
}
---
}
Impact Details
References
Proof of Concept
Previous58105 sc medium zeroxswapverifier decodes execute payload with wrong abi bytes vs bytes temporary freezing of fundsNext58210 sc low incorrect balance measurement in deallocation disables loss detection in morphoyearnogweth
Was this helpful?