Skip to content
DoS Audit finding Intermediate

The `V3AMO._mintAndSellBoost()` function does not work with Velodrome, Aerodrome, Fenix, Thena and Ramses

The `_mintAndSellBoost()` function calls the `swap()` function on SolidlyV3 DEX pools with parameters that do not match the actual `swap()` signature used by Velodrome, Aerodrome, Fenix, Thena and Ramses. As a result, the function reverts, preventing the protocol from minting and selling BOOST tokens to restore the peg.

ABA Follow with Kirkeelee, KupiaSec and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-10-axion-judging/issues/268

Found by

ABA, Kirkeelee, KupiaSec, carrotsmuggler, pkqs90

Summary

The protocol mints BOOST tokens and sells them for USD using the _mintAndSellBoost() function for SolidlyV3 DEXes. Since Velodrome, Aerodrome, Fenix, Thena and Ramses are parts of the SolidlyV3 DEXes, they should be compatible. However, the _mintAndSellBoost() function does not work with the DEXes due to incorrect function parameters.

Root Cause

In the _mintAndSellBoost() function, it mints BOOST tokens and swaps them for USD tokens.

https://github.com/sherlock-audit/2024-10-axion/blob/c65e662999d0c79439703fc6713814b4ad023e01/liquidity-amo/contracts/SolidlyV3AMO.sol#L144-L151

Solidity
File: liquidity-amo\contracts\SolidlyV3AMO.sol
144: @>      (int256 amount0, int256 amount1) = ISolidlyV3Pool(pool).swap(
145:             address(this),
146:             boost < usd,
147:             int256(boostAmount), // Amount of BOOST tokens being swapped
148:             targetSqrtPriceX96, // The target square root price
149:             minUsdAmountOut, // Minimum acceptable amount of USD to receive from the swap
150:             deadline
151:         );

However, the swap() function of Velodrome, Aerodrome, Fenix, Thena and Ramses has different parameters. The swap() functions of the DEXes are as follows:

Velodrome : https://optimistic.etherscan.io/address/0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F#code:~:text=File%208%20of%2037%20%3A%20CLPool.sol L613-L619

Aerodrome : https://basescan.org/address/0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A#code:~:text=File%208%20of%2037%20%3A%20CLPool.sol L679-L685

Fenix : https://blastscan.io/address/0x5aCCAc55f692Ae2F065CEdDF5924C8f6B53cDaa8#code:~:text=File%202%20of%2044%20%3A%20AlgebraPool.sol L212-L218

Thena : https://bscscan.com/address/0xc89F69Baa3ff17a842AB2DE89E5Fc8a8e2cc7358#code:~:text=File%202%20of%2031%20%3A%20AlgebraPool.sol L591-L597

Ramses : https://arbiscan.io/address/0xf896d16fa56a625802b6013f9f9202790ec69908#code:~:text=File%2044%20of%2045%20%3A%20RamsesV2Pool.sol L944-L950

Solidity
  function swap(
    address recipient,
    bool zeroToOne,
    int256 amountRequired,
    uint160 limitSqrtPrice,
    bytes calldata data
  ) external override returns (int256 amount0, int256 amount1) {   

As a result, the _mintAndSellBoost() function does not work with Velodrome, Aerodrome, Fenix, Thena and Ramses due to incorrect function parameters.

Internal pre-conditions

For convenience, let's assume that the USD token is USDC from this point forward.

  • Protocol team is going to mint additional BOOST and sell them for USDC to bring the price back down to peg.

External pre-conditions

  • The BOOST-USDC price diverges from peg and BOOST is trading above $1 in Velodrome.

Attack Path

  • Alice(protocol team) calls the mintAndSellBoost() function.

It reverts.

Impact

The mintAndSellBoost(), mintSellFarm() functions will be permanently DoSed for Velodrome, Aerodrome, Fenix, Thena and Ramses. Protocol team can't mint additional BOOST and sell them for USDC to bring the price back down to peg.

PoC

Mitigation

Use the correct function parameters for Velodrome, Aerodrome, Fenix, Thena and Ramses.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/AXION-MONEY/liquidity-amo/pull/13

The original report as published on Sherlock, by ABA. 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 `_mintAndSellBoost()` function passes parameters to the `swap()` function that do not match the signature implemented by the target DEX pools.

Impact

The `mintAndSellBoost()` and `mintSellFarm()` functions are permanently disabled for the listed DEXes, so the protocol cannot mint and sell BOOST to bring its price back down to peg.

What the attacker needed

BOOST price diverges above peg on a listed DEX; Protocol team attempts to mint and sell BOOST

The fix

The protocol team fixed this issue by updating the function parameters to match the DEXes' `swap()` signature.

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 a smart contract bug where a function calls another contract's function with the wrong arguments. The target contracts expect a different set of parameters, so the call fails and the transaction reverts. This means the protocol cannot perform a key stabilisation action on several exchanges.

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 ABA

View all

3 more disclosed reports, best first.

More from AXION

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.