Gas fees are refunded to a wrong address when transferring tokens via InterchainToken.interchainTransferFrom
#316
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
downgraded by judge
Judge downgraded the risk level of this issue
M-05
primary issue
Highest quality submission among a set of duplicates
selected for report
This submission will be included/highlighted in the audit report
Lines of code
https://github.com/code-423n4/2023-07-axelar/blob/2f9b234bb8222d5fbe934beafede56bfb4522641/contracts/its/interchain-token/InterchainToken.sol#L104
Vulnerability details
Impact
In a case when gas fees are refunded for a token transfer made via the
InterchainToken.interchainTransferFrom
function, the fees will be refunded to the owner of the tokens, not the address that actually paid the fees. As a result, the sender will lose the fees paid for the cross-chain transaction and will not receive tokens on the other chain; the owner of the token will have their tokens and will receive the fees.Proof of Concept
The InterchainToken.interchainTransferFrom function is used to transfer tokens cross-chain. The function is identical to the
ERC20.transferFrom
function: an approved address can send someone else's tokens to another chain. Since this is a cross-chain transaction, the sender also has to pay the additional gas fee for executing the transaction:tokenManager.transmitInterchainTransfer
calls interchainTokenService.transmitSendToken;interchainTokenService.transmitSendToken
calls _callContract;_callContract
uses themsg.value
to pay the extra gas fees.Notice that the
gasService.payNativeGasForContractCall
call in_callContract
takes therefundTo
address, i.e. the address that will receive refunded gas fee. If we return up on the call stack, we'll see that the refund address is the sender address that's passed to thetokenManager.transmitInterchainTransfer
call. Thus, gas fees will be refunded to the token owner, not the caller, however it's the caller who pays them.Tools Used
Manual review
Recommended Mitigation Steps
The
TokenManager.transmitInterchainTransfer
and theInterchainTokenService.transmitSendToken
functions, besides taking thesender
/sourceAddress
argument, need also take the "refund to" address. In theInterchainToken.interchainTransferFrom
function, the two argument will be set to different addresses: thesender
/sourceAddress
argument will be set to the token owner address; the new "refund to" argument will be set tomsg.sender
. Thus, while tokens will be taken from their owner, the cross-chain gas fees will be refunded to the actual transaction sender.Assessed type
ETH-Transfer
The text was updated successfully, but these errors were encountered: