Submitted by immeas, also found by nobody2018
A token transfer can be express delivered on behalf of another user when the call contains data to be executed:
https://github.com/code-423n4/2023-07-axelar/blob/main/contracts/its/interchain-token-service/InterchainTokenService.sol#L467-L487
The issue here, is that check effect interactions are not followed.
There are two attack paths here with varying assumptions and originating parties:
Attacker: Anyone, assuming there are third parties providing expressReceiveTokenWithData on demand with on-chain call:
AxelarGateway operator, assuming there are third parties providing expressReceiveTokenWithData off-chain call:
The operator does the same large transfer as described above. The operator then holds the update to AxelarGateway::execute and instead, sends these instructions to their malicious destinationContract. When the expressReceiveTokenWithData is called, this malicious contract will do the same pattern as described above. Call AxelarGateway::execute then InterchainTokenService::execute.
The same attacks could work for tokens with transfer callbacks (like ERC777) with just the expressReceiveToken call, as well.
With a very large cross chain token transfer, a malicious party can use this to steal the same amount from the express receive executor.
If this fails, since it relies on front-running and some timing, the worst thing that happens for the attacker is that the transfer goes through and theyve just lost the transfer fees.
This makes some assumptions about how trusted an operator/reporter is and that there are possibilities to have expressReceiveTokens to be called essentially on demand (ExpressReceiveAsAService). If these arent valid, please regard this as a low; just noting the failure to follow checks-effects-interactions in expressReceiveToken/WithData.
The existence of expressReceive implies though, that there should be some kind of service providing this premium service for a fee.
Test in tokenService.js:
And its/test/ExpressRecipient.sol:
Consider using _setExpressReceiveTokenWithData before external calls.
Reentrancy
berndartmueller (judge) commented:
deanamiel (Axelar) confirmed and commented:
berndartmueller (judge) commented:
