The burn function in the DebtToken contract compares an unscaled amount (in underlying asset units) with a scaled balance (in DebtToken units) without proper conversion, potentially allowing burning of more tokens than the user has.
The vulnerability exists in the balance check:
The issue occurs because:
userBalance is in scaled DebtToken units
amount is in underlying asset units
Direct comparison of these different units is invalid
Setting amount = userBalance assigns scaled units to an unscaled variable
Correct comparison should be:
Additionally, the amount used in _burn is in underlying assets units instead of scaled units leading to incorrect amount of tokens being burned
Allows burning incorrect amount of tokens
Leads to incorrect debt accounting
Potential for economic attacks
System invariants could be broken
Manual Review
Consider implementing the following changes:
It's underlying vs underlying
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.