The DebtToken.burn function contains incorrect calculations. The balanceIncrease should not be added, as it is already accounted for in balanceOf(). Since balanceOf() returns the current debt of the user, the burn function only needs to reduce the tokens based on the actual debt amount, avoiding unnecessary inflation of total debt.
A user initially borrows 100 tokens when the index is 2. This results in the user holding:
super.balanceOf(user) = 50
userIndex = 2
After some time, the index increases to 4, doubling the user’s debt to 200.
The user repays 1 wei (near zero amount for test and PoC**)**, triggering the burn function.
The expected behavior is for the debt remain same (since 1 wei is near zero), but due to the incorrect calculation, an excessive amount of tokens is burned.
burn:scaledBalance = balanceOf(user) = super.balanceOf(user) * index = 50 * 4 = 200
balanceIncrease = scaledBalance * (index - userIndex) = 200 * (4 - 2) = 400
amountToBurn = amount + balanceIncrease = 1 + 400 = 401
_burn(user, 401)
The user’s balance decreases by 401/4 = 100.25, leading to an incorrect reduction in debt.
This results in excessive burning of tokens, causing an unintended decrease in the user's debt and leading to incorrect accounting in the system. Users can exploit this to unfairly reduce their obligations.
Users may mint or burn more tokens than intended, allowing them to manipulate their debt and either reduce their obligations unfairly or face unintended losses.
VS Code
Remove balanceIncrease from the DebtToken.burn function to ensure only the actual debt amount is burned, preventing unintended inflation or deflation of total debt.
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.