code4rena-2022-04-axelar-m02

[M-02] User’s funds can get lost when transferring to other chain

보고서

Summary

도착지 체인 측의 게이트웨이에 토큰이 부족하면 도착지 체인에서 토큰을 줄 수 없고 트랜잭션이 revert 된다. 출발지 체인에서 유저는 이미 토큰을 burn 또는 transfer 했기 때문에 목적지에서 받지 못하면 자산을 잃게 된다.

Keyword

bridge, cross chain, business logic vul

Vulnerability

도착지 체인에서 토큰을 줄 때, Axelar wrapped 토큰이 아닌 외부 토큰을 주어야 한다면 게이트웨이에 예치된 토큰을 transfer 한다.

이 때, 게이트웨이에 토큰이 필요한 만큼 예치되어 있지 않다면 도착지 체인 측 트랜잭션이 revert 될 것이다.

    function _mintToken(
        string memory symbol,
        address account,
        uint256 amount
    ) internal {
        address tokenAddress = tokenAddresses(symbol);
 
        if (tokenAddress == address(0)) revert TokenDoesNotExist(symbol);
 
        if (_getTokenType(symbol) == TokenType.External) {
            _checkTokenStatus(symbol);
 
@>          bool success = _callERC20Token(
@>              tokenAddress,
@>              abi.encodeWithSelector(IERC20.transfer.selector, account, amount)
@>          );
 
@>          if (!success) revert MintFailed(symbol);
        } else {
            BurnableMintableCappedERC20(tokenAddress).mint(account, amount);
        }
    }

따라서 출발지 체인에서 유저의 토큰은 burn 또는 transfer 되었지만 도착지에서는 토큰을 받지 못해 유저가 자산을 잃을 수 있다.

Impact

도착지에서는 토큰을 받지 못해 유저가 자산을 잃을 수 있다.

Mitigation

목적지 체인에서 토큰을 전송하는데 실패했다면 출발지 체인의 토큰을 반환한다.


tags: bughunting, axelar, smart contract, solidity, business-logic-vul, severity medium