The pauseTranche state can be overwritten with a lower borrower tier, so a later liquidation of a lower-tier borrower resets the paused tranche and defeats the withdrawal block for users in higher tranches. An attacker could potentially set pauseTranche to an arbitrary value by self-liquidating, but the judge noted this requires bad debt and is difficult to exploit.
When the pauseTranche id is set to the borrower tier in this line of code, the user that deposited below the paused tranche id should not be able to withdraw / tranche id share because this check is in-place:
The problem is that the paucheTranche state can be set to arbitrary value.
Suppose a user has borrower tier 10 and borrowTrueValue exceed depositTrueValue, the pauseTranche is set to 10, then a second user has borrower tier 0, he is subject to liquidation as well.
borrowTrueValue exceed depositTrueValue as well.
The pauseTranche is reset to 0 again, which defeats the check of:
pauseTranche is used to disallow the user from calling withdraw() to withdraw assets before socializeLoss() is called. As for severity, I’m not so sure it’s a High, need more thought on that.
This requires not only that the user can be liquidated, but also that the bad debt arises (there is big gap between the two), so I think it would be very difficult for an attacker to actively exploit this issue to set pauseTranche.
And as TRST-M-1 Users can avoid losses by withdrawing assets before pausing due to bad debt noted, users can withdraw preemptively to prevent socializeLoss() from causing losses.
Users can’t actively arise bad debt, medium likelihood.
Users can withdraw their assets before socialize loss, medium impact.
Agree with judge’s assessment, medium severity. There should be no loss to users, and this situation arises in the case only where a higher tranche has bad debt after a lower tranche has bad debt. The worst case scenario, is that one depositor is left with all the bad debt, which is unintended by the protocol but does not cause loss of funds compared to existing protocols — which rely on manual pause intervention, which the protocol also has as we inherit Pausable, so this is medium severity.
We will fix to the latest recommendation, which is using the pauseTranche = borrowTier > pauseTranche ? pauseTranche : borrowTier;
The original report as published on Code4rena, by ladboy233. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 40 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely the assignment pauseTranche = borrowTier overwrites any existing higher pauseTranche value instead of keeping the maximum.
Impact
The judge rated this medium severity because actively causing bad debt is difficult and users can withdraw before losses are socialised, so there is no direct loss of funds.
What the attacker needed
A borrower is liquidated with bad debt; a lower-tier borrower is later liquidated with bad debt
The fix
The team said they will fix it by keeping the higher of the current and new pauseTranche values.
How it was found
A user with borrower tier 10 is liquidated and borrowTrueValue exceeds depositTrueValue, setting pauseTranche to 10.
A second user with borrower tier 0 is also liquidated with borrowTrueValue exceeding depositTrueValue.
The pauseTranche is reset to 0, defeating the withdrawal check for tranches below 10.
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.
Generating the AI write-up for this report.
This usually takes about 40 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
In this lending protocol, users are grouped into tranches by risk level. When a borrower's debt exceeds their deposit, the protocol pauses that tranche to stop withdrawals until losses are socialised. The bug is that a later liquidation of a lower-risk tranche overwrites the paused tranche with a lower number, so the earlier pause is lost and users in the higher tranche can withdraw again.
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.