A critical issue in the mint() function of DebtToken.sol causes users to be minted more debt tokens than they should owe, leading to unintended debt inflation. The issue arises from double scaling when computing balanceIncrease, making users liable for higher debt than they actually borrowed. This leads to excessive debt accumulation, unfair borrowing conditions, and potential financial loss. The protocol must urgently address this to prevent users from being overburdened with unintended debt liabilities.
The mint() function first retrieves the user’s debt balance via:
However, balanceOf() already applies rayMul() to scale up the balance:
Later in mint(), scaledBalance is scaled again when computing balanceIncrease if tis isn't the first mint:
This results in double scaling, making balanceIncrease larger than it should be.
Consequently, the incorrectly computed balanceIncrease is added to the original borrow amount:
It then mints an inflated number of debt tokens for the user:
This means the user's debt balance incorrectly increases every time they borrow after the first mint.
Such inflated amount is also propagated via the Mint event:
Users are unfairly charged more debt than they actually borrowed from the second borrow onwards.
Compounded interest is applied on an inflated debt principal, making the issue exponentially worse over time.
Borrowers may face liquidation sooner than expected, even if they initially borrowed responsibly.
Protocol fairness and stability are at risk, as some users may unknowingly become significantly over-leveraged.
Potential reputational damage to the lending protocol, as users experience unexpected losses.
Manual
Consider making the following code refactoring:
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.