Boost _ Folks Finance 34132 - [Smart Contract - Low] Liquidation bonus incorrectly inflates repayBor
Description
Brief/Intro
Vulnerability Details
function calcLiquidationAmounts(
// ...
) external view returns (DataTypes.LiquidationAmountParams memory liquidationAmounts) {
// ...
uint256 repayBorrowAmount;
{
uint256 maxRepayBorrowAmount = MathUtils.calcAssetAmount(
maxRepayBorrowValue * MathUtils.ONE_10_DP,
borrPriceFeed.price,
borrPriceFeed.decimals
);
repayBorrowAmount = Math.min(maxAmountToRepay, Math.min(maxRepayBorrowAmount, violatorLoanBorrow.balance));
}
{
uint256 seizeUnderlyingCollateralAmount = repayBorrowAmount.convToSeizedCollateralAmount(
collPriceFeed.price,
collPriceFeed.decimals,
borrPriceFeed.price,
borrPriceFeed.decimals,
borrowLoanPool.liquidationBonus
);
uint256 collDepositInterestIndex = collPool.getUpdatedDepositInterestIndex();
uint256 violatorUnderlingCollateralBalance = violatorLoanCollateral.balance.toUnderlingAmount(
collDepositInterestIndex
);
if (seizeUnderlyingCollateralAmount > violatorUnderlingCollateralBalance) {
seizeUnderlyingCollateralAmount = violatorUnderlingCollateralBalance;
@> repayBorrowAmount = seizeUnderlyingCollateralAmount.convToRepayBorrowAmount(
collPriceFeed.price,
collPriceFeed.decimals,
borrPriceFeed.price,
borrPriceFeed.decimals,
borrowLoanPool.liquidationBonus
);
}
liquidationAmounts.repayBorrowAmount = repayBorrowAmount;
liquidationAmounts.repayBorrowToCollateralFAmount = repayBorrowAmount.convToCollateralFAmount(
collPriceFeed.price,
collPriceFeed.decimals,
borrPriceFeed.price,
borrPriceFeed.decimals,
collDepositInterestIndex
);
liquidationAmounts.seizeCollateralFAmount = seizeUnderlyingCollateralAmount.toFAmount(
collDepositInterestIndex
);
}
}Impact Details
References
Proof of concept
Proof of Concept
PreviousBoost _ Folks Finance 34127 - [Smart Contract - Low] Liquidator gets more debt than usualNextBoost _ Folks Finance 34148 - [Smart Contract - Low] Full liquidations will fail for certain unhealt
Last updated
Was this helpful?