User’s funds can get lost when transferring to other chain
When transferring tokens to another chain, if the destination gateway lacks sufficient tokens, the transfer fails and the user loses funds on the source chain. An attacker could exploit this by causing the destination gateway to have insufficient tokens, leading to loss of user funds.
Originally disclosed on Code4rena
Submitted by CertoraInc
When transferring tokens to other chain, the tokens in the source chain are burned - if they are external they will be transferred to the AxelarGateway, otherwise they will be burned. In the target chain the same amount of tokens will be minted for the user - if it is external it will be transferred to him from the AxelarGateway, otherwise it will be minted to him.
But there is a problem - if the AxelarGateway doesn’t have the needed amount of token for some reason, the _callERC20Token with the transfer function selector will fail and return false, which will make the _mintToken function revert. Because it reverted, the user won’t get his funds on the destination chain, although he payed the needed amount in the source chain.
Tools Used
VS Code and Remix
Recommended Mitigation Steps
Instead of reverting when the transfer is not successful, simply call the callContractWithToken with the source chain as the destination chain in order to return the user his funds.
deluca-mike (Axelar) acknowledged and commented:
While true, the only way the destination gateway cannot mint or transfer token, in response to a burn or transferFrom on the source chain, is foul play on the validators’ part. Once we assume foul play, then really there is no protection here, since even with the recommended mitigation steps, you’d still need cooperation from the validators to sign the mint/transfer refund command for the source gateway.
Because of this, while the issue is acknowledged, it’s not really something that can be solved.
Further, well-behaving validators can still sign a refund mint/transfer for the source gateway if they see that a mint/transfer on the destination gateway failed, without needing to do what is suggested in the Recommended Mitigation Steps.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
A user could lose their funds if the destination gateway lacks sufficient tokens, as the transfer reverts and no refund is issued.
What the attacker needed
Destination gateway lacks tokens
The fix
Instead of reverting, the contract should initiate a refund by calling `callContractWithToken` with the source chain as the destination.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is about a cross-chain bridge that moves tokens between blockchains. When you send tokens, they are burned on the source chain and new ones are created on the destination chain. The bug is that if the destination bridge does not have enough tokens to give you, the transaction fails and your original tokens are already gone, so you lose them.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.