setDebtInterestApr should accrue debt first
The setDebtInterestApr function changes the debt interest rate without first accruing the debt, so the new rate is applied retroactively to the unaccrued period on the next accrue() call. Borrowers can incur more debt than they should.
Submitted by cmichel, also found by pedroais
The setDebtInterestApr changes the debt interest rate without first accruing the debt.
This means that the new debt interest rate is applied retroactively to the unaccrued period on next accrue() call.
It should never be applied retroactively to a previous time window as this is unfair & wrong. Borrowers can incur more debt than they should.
Recommended Mitigation Steps
Call accrue() first in setDebtInterestApr before setting the new settings.debtInterestApr.
spaghettieth (JPEG’d) confirmed
spaghettieth (JPEG’d) resolved and commented:
Fixed in jpegd/core#4.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The setDebtInterestApr function updates the interest rate without first calling accrue() to record interest up to the current time.
Impact
Borrowers could incur more debt than they should because the new rate is applied retroactively to the unaccrued period.
What the attacker needed
None
The fix
The function should call accrue() before setting the new debt interest rate; the report states it was fixed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a lending system, interest builds up over time and is recorded when someone calls a function to update the debt. If you change the interest rate without first recording the interest earned so far, the new rate gets applied to the past period too. That means borrowers are charged the new rate for time that has already passed, which is unfair and can make them owe more than expected.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.