Submitted by 0xTheC0der
According to the docs, the Axelar network supports cross-chain bridging of external ERC20 tokens, as well as their own StandardizedToken (using lock/unlock, mint/burn or liquidity pools).
A cross-chain bridging can be performed using the TokenManager.sendToken() method, which correctly collects the source tokens from the sender and subsequently calls the InterchainTokenService.transmitSendToken() method that generates the payload for the remote ContractCall and also emits the TokenSent event.
However, this payload, as well as the subsequently emitted ContractCall and TokenSent events (see InterchainTokenService:L512-L514) contain the unscaled source amount with respect to the source tokens decimals.
Next, this exact payload (actually its keccak256 hash) gets relayed on the remote chain as it is via AxelarGateway.approveContractCall() and the ContractCall is now approved to be executed with the source amount irrespective of the remote tokens decimals.
Therefore, the bridged amounts are off by a factor of 10^abs(sourceDecimals - remoteDecimals).
Note that there are also other ways/entry points to reproduce this issue with the current codebase.
This leads to a loss of funds for user/protocol/pool when source token decimals are lower/higher than remote token decimals, because the token amount is just passed through instead of being scaled accordingly.
The first part of the PoC demonstrates the following:
Just apply the diff below and run the test with npm run test test/its/tokenServiceFullFlow.js:
The second part of the PoC demonstrates that the aforementioned payload is relayed/approved as it is to the remote chain and the source token amount is received on the remote chain irrespective of the remote tokens decimals.
Just apply the diff below and run the test with npm run test test/its/tokenService.js:
VS Code, Hardhat
This issue cannot be solved easily since the remote chain doesnt know about the token decimals on the source chain and vice versa. I suggest the following options:
Decimal
deanamiel (Axelar) disagreed with severity and commented:
berndartmueller (judge) decreased severity to QA and commented:
0xTheC0der (warden) commented:
berndartmueller (judge) commented:
berndartmueller (judge) increased severity to Medium
deanamiel (Axelar) commented:
berndartmueller (judge) commented:
milapsheth (Axelar) commented:
