Skip to content
DoS Audit finding Intermediate

Interchain token transfer can be dossed due to flow limit

The interchain token transfer system enforces a per-epoch flow limit, and a large token holder can exhaust this limit at the start of each epoch, preventing other users from transferring that token across chains. This can be repeated across multiple lanes and chains at low cost, causing temporary denial of service.

nirlin Follow with QiuhaoLi

Originally disclosed on Code4rena

Submitted by nirlin, also found by QiuhaoLi

Lines of code

https://github.com/code-423n4/2023-07-axelar/blob/2f9b234bb8222d5fbe934beafede56bfb4522641/contracts/its/token-manager/TokenManager.sol#L83-L173 https://github.com/code-423n4/2023-07-axelar/blob/2f9b234bb8222d5fbe934beafede56bfb4522641/contracts/its/interchain-token/InterchainToken.sol#L1-L106

Impact

A large token holder can send back and forth tokens using the flow limit to the capacity in the start of every epoch, making the system unusable for everyone else.

Proof of Concept

Interchain tokens can be transferred from one chain to another via the token manager and interchain token service. There is a limit imposed for both the flow out and flow in.

Flow out happens when you send the token from one chain to another. Lets say arbitrum to optimism and you are sending USDC. So in this case, in context of arbitrum, it will be flow out and in context of optimism. Then, it will be flow in and the receiver on optimism will get the tokens via the token manager giveToken() callable by the inter chain token service; however, there is a flow limit imposed per epoch.

One Epoch = 6 hours long.

So there cannot be more than a certain amount of tokens sent between the chain per 6 hours. This is done to protect from the uncertain conditions, like a security breach, and to secure as many of the tokens as possible. However, the problem with such a design, is a big token holder or whale could easily exploit it to DOS the other users.

Consider the following scenario:

  1. The Epoch starts.
  2. Limit imposed for the flow is 10 million USDC (considering USDC to be interchain token for ease of understanding).
  3. A big whale transfer 10 million USDC at the start of the epoch. Those are there, but may or may not receive them on other end right away.
  4. But the limit has been reached for the specific epoch. Now, no other user can use the axelar interchain token service to transfer that particular token on the dossed lane.
  5. Now, an attacker can repeat the process across multiple lanes on a multiple chain or one, in the start of every epoch, making it unusable for everyone with a very minimum cost.

This attack is pretty simple and easy to achieve and also very cheap to do; specifically, on the L2’s or other cheap chains due to low gas prices.

The functions using the flow limit utility in tokenManager.sol are the following:

    function sendToken(
        string calldata destinationChain,
        bytes calldata destinationAddress,
        uint256 amount,
        bytes calldata metadata
    ) external payable virtual {
        address sender = msg.sender;
        amount = _takeToken(sender, amount);
        _addFlowOut(amount);
        interchainTokenService.transmitSendToken{ value: msg.value }(
            _getTokenId(),
            sender,
            destinationChain,
            destinationAddress,
            amount,
            metadata
        );
    }

    /**
     * @notice Calls the service to initiate the a cross-chain transfer with data after taking the appropriate amount of tokens from the user.
     * @param destinationChain the name of the chain to send tokens to.
     * @param destinationAddress the address of the user to send tokens to.
     * @param amount the amount of tokens to take from msg.sender.
     * @param data the data to pass to the destination contract.
     */
    function callContractWithInterchainToken(
        string calldata destinationChain,
        bytes calldata destinationAddress,
        uint256 amount,
        bytes calldata data
    ) external payable virtual {
        address sender = msg.sender;
        amount = _takeToken(sender, amount);
        _addFlowOut(amount);
        uint32 version = 0;
        interchainTokenService.transmitSendToken{ value: msg.value }(
            _getTokenId(),
            sender,
            destinationChain,
            destinationAddress,
            amount,
            abi.encodePacked(version, data)
        );
    }

    /**
     * @notice Calls the service to initiate the a cross-chain transfer after taking the appropriate amount of tokens from the user. This can only be called by the token itself.
     * @param sender the address of the user paying for the cross chain transfer.
     * @param destinationChain the name of the chain to send tokens to.
     * @param destinationAddress the address of the user to send tokens to.
     * @param amount the amount of tokens to take from msg.sender.
     */
    function transmitInterchainTransfer(
        address sender,
        string calldata destinationChain,
        bytes calldata destinationAddress,
        uint256 amount,
        bytes calldata metadata
    ) external payable virtual onlyToken {
        amount = _takeToken(sender, amount);
        _addFlowOut(amount);
        interchainTokenService.transmitSendToken{ value: msg.value }(
            _getTokenId(),
            sender,
            destinationChain,
            destinationAddress,
            amount,
            metadata
        );
    }

    /**
     * @notice This function gives token to a specified address. Can only be called by the service.
     * @param destinationAddress the address to give tokens to.
     * @param amount the amount of token to give.
     * @return the amount of token actually given, which will only be different than `amount` in cases where the token takes some on-transfer fee.
     */
    function giveToken(address destinationAddress, uint256 amount) external onlyService returns (uint256) {
        amount = _giveToken(destinationAddress, amount);
        _addFlowIn(amount);
        return amount;
    }

    /**
     * @notice This function sets the flow limit for this TokenManager. Can only be called by the operator.
     * @param flowLimit the maximum difference between the tokens flowing in and/or out at any given interval of time (6h)
     */
    function setFlowLimit(uint256 flowLimit) external onlyOperator {
        _setFlowLimit(flowLimit);
    }

Recommended Mitigation Steps

There could be many solutions for this. But two solutions are:

  1. Do the Chainlink CCIP way, Chainlink recently launched cross chain service that solved a similar problem by imposing the token bps fee. By imposing such a fee along with a gas fee, the cost of attack becomes way higher and the system can be protected from such an attack.
  2. Introduce the mechanism of limit per account instead of whole limit. But that can be exploited too by doing it through multiple accounts.

Chainlink’s way would be the better solution to go with IMO.

Assessed type

DoS

deanamiel (Axelar) disagreed with severity and commented:

Corrected Severity: QA

This behavior is intentional. If an attacker tries to block one way (either in or out), the operator can respond by increasing the flowLimit (or setting it to 0, meaning there’s no limit at all) to help handle the attack. We prefer to keep fees as low as possible, so we would not want to use the Chainlink method that was suggested.

berndartmueller (judge) decreased severity to Medium and commented:

Even though this is intentional, the demonstrated issue can cause temporary availability (inability to transfer tokens) issues for the token service. This qualifies for medium severity, according to the C4 judging criteria:

Assets not at direct risk, but the function of the protocol or its availability could be impacted

milapsheth (Axelar) commented:

We consider this QA for the following reasons:

  1. Rate limits are intended to reduce availability/liveness on large transfers, so liveness concern by itself isn’t applicable to judge this issue.
  2. Rate limits are opt-in and updatable, operators are recommended to choose the parameters carefully to determine the risk/liveness trade-off, and take operational responsibility to maintain it.
  3. The design is intentional. We consider other proposed designs to have worse trade-offs. A bps fee introduces a fee-on-transfer behaviour, and a high cost to otherwise honest large transfers. Per account limits are not Sybil resistant. We’re happy to consider other designs if they’re better, but the report doesn’t cover that.

The original report as published on Code4rena, by nirlin. 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 flow limit is global per token and epoch, so a single large transfer can consume the entire allowance, leaving none for other users.

Impact

The token transfer service becomes temporarily unavailable for other users on affected lanes, but the operator can respond by increasing or removing the flow limit.

What the attacker needed

A large token balance; ability to send interchain transfers; low gas costs on some chains

The fix

The design is intentional and the team considers it acceptable; they suggest operators can adjust the flow limit if needed, and the report proposes a fee-based or per-account limit as alternatives.

How it was found

  1. Wait for a new epoch to start.
  2. Send a large amount of the token that reaches the flow limit for that epoch.
  3. Other users can no longer transfer that token on that lane until the next epoch.
  4. Repeat at the start of every epoch across multiple lanes or chains.

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 system lets people move tokens between blockchains, but it has a safety cap on how many tokens can move in a six-hour window. A rich attacker can fill that cap immediately, so normal users cannot move their tokens until the next window. The attacker does not steal anything; they just block others from using the service.

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 nirlin

View all

2 more disclosed reports, best first.

More from Axelar Network

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.