Skip to content
DoS Audit finding Intermediate

DOS to `liquidateBorrowPosition` on MODE chain

On the MODE chain, the liquidation function can fail because the fallback liquidation method relies on the Synthetix protocol, which is not available there. This causes a denial of service for liquidations until enough USDa is available in the CDS pool.

John44 Follow with nuthan2x and valuevalk

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/131

Found by

John44, nuthan2x, valuevalk

Summary

borrowLiquidation.liquidateBorrowPosition is done via liquidationType1 with CDS pool, or via liquidationType2 on synthetix. According to team, the liquidationType2 is chosen if liquidationType1 reverts when USDa in CDS is not enough to liquidate, ex: during omniChainData.totalAvailableLiquidationAmount < liquidationAmountNeeded

In these cases, the liquidationType2 is used to liquidate. But synthetix protocol isn't there on MODE. Hence liquidations fail. There will be DOS till USDa is available on CDS.

Root Cause

liquidationType2 is possible only Optimism and not possible on MODE due to the absence of synthetix protocol on MODE. so liquidationType2 will revert.

Internal pre-conditions

when USDa in CDS isn't enough to cover the liquidation, so liquidationType2 has to be chosen

External pre-conditions

liquidation happening on MODE chain

Attack Path

A user's position should be liquidated so, admin calls liquidateBorrowPosition via borrowing contract. Since, the USDa amount on CDS is low enough, we can't choose type 1 liquidation due to a strict revert check. So, type 2 is chosen to short on synthetix, but it will revert due to the absence of synthetix protocol on MODE

borrowLiquidation.liquidateBorrowPosition

Solidity

    function liquidateBorrowPosition(
        address user,
        uint64 index,
        uint64 currentEthPrice,
        IBorrowing.LiquidationType liquidationType,
        uint256 lastCumulativeRate
    ) external payable onlyBorrowingContract returns (CDSInterface.LiquidationInfo memory liquidationInfo) {
        //? Based on liquidationType do the liquidation
        // Type 1: Liquidation through CDS
        if (liquidationType == IBorrowing.LiquidationType.ONE) {
   @>       return liquidationType1(user, index, currentEthPrice, lastCumulativeRate);
            // Type 2: Liquidation by taking short position in synthetix with 1x leverage
        } else if (liquidationType == IBorrowing.LiquidationType.TWO) {
   @>       liquidationType2(user, index, currentEthPrice);
        }
    }

    function liquidationType2(
        address user,
        uint64 index,
        uint64 currentEthPrice
    ) internal {
//////////////////////////////////////
/////////////////////////////////////

        // Mint sETH
        wrapper.mint(amount);
        // Exchange sETH with sUSD
   @>   synthetix.exchange(
            0x7345544800000000000000000000000000000000000000000000000000000000,
            amount,
            0x7355534400000000000000000000000000000000000000000000000000000000
        );

        // Calculate the margin
        int256 margin = int256((amount * currentEthPrice) / 100);
        // Transfer the margin to synthetix
        synthetixPerpsV2.transferMargin(margin);

        // Submit an offchain delayed order in synthetix for short position with 1X leverage
        synthetixPerpsV2.submitOffchainDelayedOrder(
            -int((uint(margin * 1 ether * 1e16) / currentEthPrice)),
            currentEthPrice * 1e16
        );
    }

    function liquidationType1(
        address user,
        uint64 index,
        uint64 currentEthPrice,
        uint256 lastCumulativeRate
    ) internal returns (CDSInterface.LiquidationInfo memory liquidationInfo) {

//////////////////////////////////////
/////////////////////////////////////
        // Calculate borrower's debt
        uint256 borrowerDebt = ((depositDetail.normalizedAmount * lastCumulativeRate) / BorrowLib.RATE_PRECISION);
        uint128 returnToTreasury = uint128(borrowerDebt);

        // 20% to abond usda pool
        uint128 returnToAbond = BorrowLib.calculateReturnToAbond(depositDetail.depositedAmountInETH, depositDetail.ethPriceAtDeposit, returnToTreasury);
        treasury.updateAbondUSDaPool(returnToAbond, true);
        // Calculate the CDS profits
        uint128 cdsProfits = (((depositDetail.depositedAmountInETH * depositDetail.ethPriceAtDeposit) / BorrowLib.USDA_PRECISION) / 100) - returnToTreasury - returnToAbond;
        // Liquidation amount in usda needed for liquidation
        uint128 liquidationAmountNeeded = returnToTreasury + returnToAbond;
        // Check whether the cds have enough usda for liquidation
   @>   require(omniChainData.totalAvailableLiquidationAmount >= liquidationAmountNeeded, "Don't have enough USDa in CDS to liquidate");

//////////////////////////////////////
/////////////////////////////////////
        return liquidationInfo;
    }

Impact

DOS to liquidations on MODE chain, due to reverts of both liquidationType1 and liquidationType2. Liquidation is an important part of system, so DOSing it under conditions like low USDa amount on CDS will be an issue.

PoC

No response

Mitigation

If liquidationType1 reverts due to lack of USDa, then implement type 3 on mode network to integrate with a fork/similar protocol like synthetix allows to Liquidate the position by taking short position

The original report as published on Sherlock, by John44. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 backup liquidation method (liquidationType2) depends on the Synthetix protocol, which is not deployed on the MODE chain, so it always reverts there.

Impact

Liquidations on the MODE chain are blocked (denial of service) when the CDS pool lacks sufficient USDa, because both liquidation methods revert.

What the attacker needed

Liquidation on MODE chain; insufficient USDa in CDS pool

The fix

Implement a third liquidation method on MODE that uses a Synthetix-like protocol or fork to allow shorting the position when liquidationType1 fails due to insufficient USDa.

How it was found

  1. A user's position becomes eligible for liquidation.
  2. The admin calls liquidateBorrowPosition via the borrowing contract.
  3. The USDa amount in the CDS pool is too low, so liquidationType1 reverts due to a strict check.
  4. The system tries liquidationType2, which attempts to interact with Synthetix.
  5. Because Synthetix is not present on MODE, liquidationType2 reverts, causing a denial of service.

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.

When a borrower's position becomes unsafe, the system tries to liquidate it to protect the protocol. On the MODE chain, if the main liquidation method cannot be used because there is not enough of a token called USDa, the system tries a backup method that depends on another service called Synthetix. But Synthetix does not exist on MODE, so the backup also fails, and the position cannot be liquidated at all.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by John44

View all

2 more disclosed reports, best first.

More from Autonomint Colored Dollar V1

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.