Skip to content
DoS Audit finding Intermediate

`liquidationType2()` will always due wrong assumption that Asset:sAsset are minted 1:1

The liquidation function assumes that minting sETH from ETH yields an equal amount of sETH, but the wrapper deducts a minting fee, so the subsequent exchange call tries to move more sETH than was actually received. This makes the liquidation path revert, causing a denial of service for that liquidation flow.

Audinarey Follow with John44 and pashap9990

Originally disclosed on Sherlock

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

Found by

Audinarey, John44, pashap9990

Summary

No response

Root Cause

The problem is that the developer wrongly assumes ETH:sETH is minted 1:1 and as such an equivalent amount of sETH is received when wrapper::mint() was called and as such when synthetix.exchange() is called it attempts to transfer more than the amount of sETH it actually has to exchange for sUSD

Solidity
File: borrowLiquidation.sol
324:     function liquidationType2( //@audit SUBMITTED-MED: missing  omnichainData update (sponsor confirmed)
325:         address user,
326:         uint64 index,
327:         uint64 currentEthPrice
328:     ) internal {

/////           .....................

348:    @>   wrapper.mint(amount);
349:         // Exchange sETH with sUSD
350:         synthetix.exchange( 
351:             0x7345544800000000000000000000000000000000000000000000000000000000,
352:  @>         amount,
353:             0x7355534400000000000000000000000000000000000000000000000000000000
354:         );

A look at the wrapper::mint() function in the wrapper contract shows that fee are removed from from the input amount during minting

Solidity
    function mint(uint amountIn) external notPaused issuanceActive {
        ///    ...................

 @>     (uint feeAmountTarget, bool negative) = calculateMintFee(actualAmountIn);
  @>    uint mintAmount = negative ? actualAmountIn.add(feeAmountTarget) : actualAmountIn.sub(feeAmountTarget);

        // Transfer token from user.
        bool success = _safeTransferFrom(address(token), msg.sender, address(this), actualAmountIn);
        require(success, "Transfer did not succeed");

        // Mint tokens to user
 @>     _mint(mintAmount);

        emit Minted(msg.sender, mintAmount, negative ? 0 : feeAmountTarget, actualAmountIn);
    }

The amount of sAsset actually received is less minting fees and as such calling exchange with amount` will revert

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

This can lead to a DOS using liquidationType2()

PoC

No response

Mitigation

considering caching the actual balance of sETH received from the wrapper and use it to call exchange()`

The original report as published on Sherlock, by Audinarey. 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

Likely the code passes the original input amount to the exchange call instead of the actual sETH balance received after the minting fee was deducted.

Impact

Liquidations through this function could be blocked, causing a denial of service for that path.

What the attacker needed

LiquidationType2 path is triggered

The fix

The code should record the actual sETH balance received from the wrapper and use that amount when calling exchange.

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 you swap one token for another, a fee can be taken, so you get back slightly less than you put in. This code assumed it got back exactly the same amount and then tried to spend that full amount, which fails because the balance is short. The result is that this particular liquidation action cannot complete.

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 Audinarey

View all

10 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.