Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[M] Unused gasValue is not refunded when calling deployRemoteCanonicalToken to the destination chain #387

Closed
code423n4 opened this issue Jul 21, 2023 · 7 comments
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 sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-07-axelar/blob/2f9b234bb8222d5fbe934beafede56bfb4522641/contracts/its/interchain-token-service/InterchainTokenService.sol#L325

Vulnerability details

Impact

In InterchainTokenService, its used to deploy multiple tokenManagers on different chains.

According to the dev comments:

  • @dev gasValue exists because this function can be part of a multicall involving
    multiple functions that could make remote contract calls.

However, when deployRemoteCanonicalToken is called, the gasValue sent could exceed the required gas fee for the function to execute successfully on the destination chain.

Proof of Concept

Occasionally, transactions can get "stuck" in the pipeline from a source to destination chain
(e.g. due to one-off issues that arise with relayers that operate on top of the network).

Transactions have typically gotten "stuck" in the pipeline due to:

  1. The transaction failing to relay from the source chain into the Axelar network for processing.
  2. The transaction failing to get executed on the destination chain.

This will lead to in some instances excess gas being sent and not used.
Therefore, the excess gas will not be refunded to the user.

This is existential across a few functions in InterchainTokenService.

Including deployAndRegisterRemoteStandardizedToken and deployRemoteCustomTokenManager.

Tools Used

Manual Review

Recommended Mitigation Steps

I would suggest to use a gas refund mechanism to refund the unused gas to the user or
provide a cancel option if the transaction failed, from the source chain or destination chain,
and allow the user to get the gas refund.

Assessed type

Other

@code423n4 code423n4 added 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 labels Jul 21, 2023
code423n4 added a commit that referenced this issue Jul 21, 2023
@c4-pre-sort
Copy link

0xSorryNotSorry marked the issue as duplicate of #316

@c4-judge c4-judge reopened this Sep 1, 2023
@c4-judge
Copy link

c4-judge commented Sep 1, 2023

berndartmueller marked the issue as not a duplicate

@berndartmueller
Copy link
Member

Wrongly duplicated to #316

Kindly invite the sponsor's feedback. @deanamiel

@c4-sponsor
Copy link

deanamiel (sponsor) disputed

@c4-sponsor c4-sponsor added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Sep 7, 2023
@deanamiel
Copy link

This is not a code related issue specific to the interchain token service, it is a more general concern related to the Axelar stack as a whole. There should not be any calls that get stuck like this.

@berndartmueller
Copy link
Member

Invalidating the submission. Failed transactions during relaying should be paid from the provided gas fees by the user to compensate the relayer.

@c4-judge
Copy link

c4-judge commented Sep 8, 2023

berndartmueller marked the issue as unsatisfactory:
Invalid

@c4-judge c4-judge closed this as completed Sep 8, 2023
@c4-judge c4-judge added the unsatisfactory does not satisfy C4 submission criteria; not eligible for awards label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

6 participants