In LendingPool.sol
, borrow()
when the User's borrow scaledAmount
is being added to scaledDebtBalance
the balanceIncrease
from repay()
is not accounted for.
Meaning borrower's debt balance won't be updated correctly ( underestimation of debt )-> the accured interest (for lenders ) won't be properly accounted for -> borrowers can repay less then they should, leading to bad debt, loss of money for lenders and protocol owners.
A user can borrow and repay without paying the accrued interest. The additional interest calculated over time is not added to scaledDebtBalance
before new borrow amounts are applied. This allows borrowers to repay only the principal amount while avoiding interest payments.
Borrowers can continuously borrow and repay without their debt balance growing correctly.
This leads to bad debt accumulation, where total outstanding debt is less than expected.
Lenders lose expected interest payments, making lending unprofitable.
Protocol sustainability is at risk, as its reserves will deplete over time.
POC
Borrower deposits 1000 USDC as collateral.
Borrower takes a loan of 1000 USDC.
30 days pass, and interest should accrue.
Borrower repays only 1000 USDC, without accounting for accrued interest.
Borrower immediately borrows 1000 USDC again, exploiting the missing interest update.
Debt balance remains artificially low, demonstrating the vulnerability.
Medium. While not imidiatly protocol breaking, over time can do serious damage.
Potential Insolvency: If this issue persists, the lending pool may become undercollateralized, leading to systemic failures.
Less people using the protocol: As mentionned lenders loose most of their investment's profit leading to users leaving the protocol.
Manual Code Review
Test Simulations in Hardhat
To prevent this vulnerability, update user.scaledDebtBalance
before adding new borrow amounts by incorporating the accrued interest (balanceIncrease
):
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.