In the StabilityPool.sol contract the liquidateBorrower function incorrectly calculates the scaledUserDebt by multiplying userDebt by the usage index again, leading to an incorrect debt amount.
The vulnerability arises from the incorrect calculation of scaledUserDebt in the liquidateBorrower function. The userDebt value retrieved from the LendingPool is already multiplied by the usage index. Multiplying it again by the usage index results in an inflated debt amount. This incorrect calculation can lead to overestimation of the debt, causing the Stability Pool to transfer more funds than necessary during liquidation.
By overestimating the debt amount, the Stability Pool may transfer more funds than required to cover the user's debt. This can lead to unnecessary depletion of the Stability Pool's funds, reducing the available liquidity for other operations and potentially causing financial losses for the protocol. Additionally, it can result in unfair liquidations, where users are penalized more than they should be based on their actual debt.
Manual Review
To mitigate this vulnerability, update the liquidateBorrower function to use the userDebt value directly without multiplying it again by the usage index. Here is an example of how to implement this:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.