Last Trove may be prevented from redeeming
The redemption function checks that the redeemer's LUSD balance is not greater than the total LUSD debt for that collateral type, an invariant that only holds in single-collateral systems. In a multi-collateral system, an attacker can send a small amount of LUSD to the last remaining trove holder, pushing their balance above the collateral's debt and preventing them from redeeming.
ltyu Follow with GalloDaSballo
Originally disclosed on Code4rena
Submitted by ltyu, also found by GalloDaSballo
In redeemCollateral() of RedemptionHelper.sol, the LUSD balanceOf the redeemer is checked against the specific collateral recorded LUSD debt (both active and defaulted).
function redeemCollateral(
address _collateral,
address _redeemer,
uint _LUSDamount,
address _firstRedemptionHint,
address _upperPartialRedemptionHint,
address _lowerPartialRedemptionHint,
uint _partialRedemptionHintNICR,
uint _maxIterations,
uint _maxFeePercentage
)
external override
{
_requireCallerIsTroveManager();
_requireValidCollateralAddress(_collateral);
RedemptionTotals memory totals;
_requireValidMaxFeePercentage(_maxFeePercentage);
_requireAfterBootstrapPeriod();
totals.price = priceFeed.fetchPrice(_collateral);
ICollateralConfig collateralConfigCached = collateralConfig;
totals.collDecimals = collateralConfigCached.getCollateralDecimals(_collateral);
totals.collMCR = collateralConfigCached.getCollateralMCR(_collateral);
_requireTCRoverMCR(_collateral, totals.price, totals.collDecimals, totals.collMCR);
_requireAmountGreaterThanZero(_LUSDamount);
_requireLUSDBalanceCoversRedemption(lusdToken, _redeemer, _LUSDamount);
totals.totalLUSDSupplyAtStart = getEntireSystemDebt(_collateral);
// Confirm redeemer's balance is less than total LUSD supply
assert(lusdToken.balanceOf(_redeemer) <= totals.totalLUSDSupplyAtStart);
...
}
This makes sense in a single collateral system such as Liquity, but is problematic in a multi-collateral one like Reserve. Since each collateral type tracks its own debt but mints the same LUSD token, LUSD supply (and thus balance) being less than the collateral debt is no longer an invariant. This can can result in:
- Last trove may be prevented from redeeming by griefers.
- Users that deposit into multiple Trove types may be prevented from redeeming.
Proof of Concept
Last trove may be prevented from redeeming
Consider the cases when
- There are 2 Trove types (wBTC and wETH).
- There is 10000 total LUSD debt in the wBTC Troves.
- Stability Pool has 150 LUSD deposited i.e. full liquidity to offset debt.
- There is 100 total LUSD debt in the wETH pool.
- ETH prices crash and all Troves get liquidated except the last one.
A griefer can front-run the last Trove from redeeming by sending the user weth with the amount entireSystemDebt + 1.
In a similar case as above, any users that may borrow from multiple Troves types such that their LUSD balance is greater than the total collateral debt will be prevented from redeeming. However, this is not as problematic because they can just send their excess tokens out.
Recommended Mitigation Steps
Consider removing this check as the invariant no longer applies.
tess3rac7 (Ethos Reserve) confirmed via duplicate issue #549
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
Likely, the code incorrectly applies a single-collateral invariant (that a redeemer's LUSD balance cannot exceed the total debt for that collateral) to a multi-collateral system where LUSD is shared across collateral types.
Impact
The last trove holder, or any user with LUSD balance exceeding the collateral's debt, may be prevented from redeeming their collateral.
What the attacker needed
Multi-collateral system with shared LUSD; attacker can front-run redemption; victim has a trove to redeem
The fix
The check should be removed because the invariant no longer applies in a multi-collateral system.
How it was found
- Have two collateral types, wBTC and wETH, with total LUSD debt of 10000 and 100 respectively.
- Have the Stability Pool fully cover the wBTC debt with 150 LUSD.
- Let ETH prices crash so all but one trove are liquidated.
- As a griefer, front-run the last trove's redemption by sending them wETH worth entireSystemDebt + 1 LUSD.
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 this system, users can borrow a stablecoin called LUSD against different types of collateral, such as wBTC or wETH. The code assumes that the total amount of LUSD in existence can never exceed the total debt recorded for a single collateral type. That assumption is false when there are multiple collateral types, because LUSD is shared across all of them. An attacker can exploit this by sending a tiny amount of LUSD to a victim, making their balance exceed the debt for that collateral and blocking their redemption.
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.