The DebtToken is minted to borrowers to track the loan + interest owed. This is done in the mint() which also has functionality to track the interest owed when users take a second loan by minting the interest owed in terms of DebtToken. However the calculation of interest owed is wrong, which causes the function to mint more DebtToken, making the users entitiled to pay more interest.
In DebtToken.sol::mint(), the function gets the interest owed by the borrowers comparing the usageIndex at 1st borrow and 2nd borrow.
The function is supposed to get the current DebtToken of the user, rayMul() it with the last usage index and current usage index to get the interest owed by the user, which will be minted on top of the borrowing amount. However, the balanceOf() returns the borrowed + interest amount because it scales the debtToken balance with the current usage index.
Thus, the function scale the underlying asset amount with the last index and current index, instead of the debtToken amount, minting more debtToken to the users.
Borrowers will pay more interest than they are owed when taking out a second loan. The issue will get bigger as the usageIndex grows.
Manual Review
Use the scaledBalanceOf() to get the debtToken balance of the user, then use it to calculate the interest owed by the user.
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.