The burn function in the DebtToken contract contains significant logic errors, including incorrect handling of the balanceIncrease parameter and flawed return values. These issues allow users to repay less interest than owed, potentially closing loans prematurely and jeopardizing the protocol's solvency.
The burn function's logic and return values are flawed in several ways:
Incorrect balanceIncrease Handling: The balanceIncrease parameter, which represents the accrued interest, is not correctly incorporated into the calculation of the amount burned. This means that users are not repaying the full amount of interest they owe.
Flawed Return Values: The function's return values are in the wrong order and do not accurately reflect the amounts burned and scaled. This can mislead external systems relying on this data.
Under-Repayment of Debt: Users can repay their loans without paying the full accrued interest, leading to a loss of revenue for the protocol.
Premature Loan Closure: Because users are not paying the full interest, loans may appear to be fully repaid when they are not, allowing users to close their positions prematurely.
Protocol Insolvency: If a significant number of users exploit this vulnerability, the protocol could face substantial losses and potentially become insolvent.
Incorrect return value: The incorrect return values lets user to repay only the principal amount without the accrued interest.
Alice borrows 100 units of an asset.
The loan accrues interest, and the balanceIncrease is calculated to be 10 units.
Alice calls reay to repay her loan and the function burn in debt token is invoked.
The burn function calculates amountScaled (e.g., to 110 if the index is 1.1).
The _burn function is called with the original amount (100), not including the interest (10).
Alice repays only 100 units, effectively avoiding paying the 10 units of interest.
The burn function returns incorrect values, further obscuring the issue.
To address this vulnerability, the burn function should be updated to correctly handle the balanceIncrease parameter and return the appropriate values. The correct
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
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.