Closed c4-bot-9 closed 10 months ago
hansfriese marked the issue as primary issue
fez-init (sponsor) disputed
Relevant lending pools should already be accrued. The liquidate
function invokes _liquidateInternal
, which invokes getPosHealthCurrent_e18
, which invokes getBorrowCreditCurrent_e36
and getCollateralCreditCurrent_e36
.
Agree with the sponsor. accrue
will be called in getBorrowCreditCurrent_e36/getCollateralCreditCurrent_e36
.
hansfriese marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-12-initcapital/blob/main/contracts/core/InitCore.sol#L303
Vulnerability details
Proof of Concept
When position is going to be liquidated, then liquidator provides
_poolToRepay
and_poolOut
. He wants to repay some amount to_poolToRepay
and get shares from_poolOut
back according to repaid amount + bonus.ILendingPool(_poolOut).toShares
function is used to calculate amount of shares that liquidator should get. The problem is thattoShares
function doesn't haveaccrue
modifier which means that in case if interests were not accrued for a long time, then calculation of shares will be incorrect. For such reason protocol has createdtoSharesCurrent
function, which accrues interests and thus calculates shares correctly.Impact
Shares are calculated incorrectly for the liquidation and liquidators actually gets bigger amount than he should.
Tools Used
VsCode
Recommended Mitigation Steps
Assessed type
Error