Skip to content
Business logic Audit finding Intermediate

UniswapV2TokenAdapter does not support Sushiswap-only assets

The UniswapV2TokenAdapter's supports function only checks UniswapV2 liquidity and returns false if it is below the minimum, without checking Sushiswap liquidity. An attacker could create a UniswapV2 pool with no liquidity for a Sushiswap-only asset, causing the adapter to reject it even though Sushiswap has sufficient liquidity.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The UniswapV2TokenAdapter.supports function calls its aboveLiquidity function which returns the UniswapV2 liquidity if the pair exists. If this is below minimumLiquidity, the supports function will return false.

However, it could be that the Sushiswap pair has lots of liquidity and could be used.

try uniswapCSSR.getLiquidity(_asset, _pairedWith) returns (
            uint256 liq
        ) {
    float memory price = cssrRouter.getPrice(_pairedWith);
    // @audit this returns early. if it's false it should check sushiswap first
    return convertToValue(liq, price) >= minimumLiquidity;
} catch {
    try sushiCSSR.getLiquidity(_asset, _pairedWith) returns (
        uint256 liq
    ) {
        float memory price = cssrRouter.getPrice(_pairedWith);
        return convertToValue(liq, price) >= minimumLiquidity;
    } catch {
        return false;
    }
}

Impact

Suppose the UniswapV2TokenAdapter wants to be used as an adapter for a Sushiswap pool. An attacker creates a UniswapV2 pool for the same pair and does not provide liquidity. The Router.setPriceSource calls UniswapV2TokenAdapter.supports and returns false as the Uniswap liquidity is too low, without checking the Sushiswap liquidity.

Recommendation

In aboveLiquidity, if the UniswapV2 liquidity is less than the minimum liquidity, instead of returning, compare the Sushiswap liquidity against this threshold.

ryuheimat (Mochi) confirmed

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

How it worked

Root cause

The supports function returns early based on UniswapV2 liquidity without falling back to check Sushiswap liquidity when UniswapV2 liquidity is insufficient.

Impact

An attacker could prevent legitimate Sushiswap-only assets from being supported by creating an empty UniswapV2 pool, potentially disrupting the protocol's functionality.

What the attacker needed

Attacker can create a UniswapV2 pool

The fix

The aboveLiquidity function should check Sushiswap liquidity when UniswapV2 liquidity is below the minimum, instead of returning false immediately.

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.

This is about a smart contract that decides if a token pair has enough liquidity to be used. It only looks at one exchange (Uniswap) and ignores another (Sushiswap). So if someone creates an empty Uniswap pool for a token that only has liquidity on Sushiswap, the contract wrongly says the token isn't supported.

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.

More by cmichel

View all

196 more disclosed reports, best first.

More from Mochi contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.