Unsafe ERC20 approve that do not handle non-standard erc20 behavior. Some token contracts do not return any value. Some token contracts revert the transaction when the allowance is not zero.
Proof of Concept
When receiving tokens to the destination chain, the token attempts to approve the destination port address.
For a token like USDT, the token needs to be approved to zero first before calling approve. This may cause a problem in the case of multiple token transfers, and because usdt is not approve, the other tokens may be stuck in the transfer process
Since the omnichain uses all sorts of tokens, it is important that the weird ERC20 tokens are counted as well.
Tools Used
VSCode
Recommended Mitigation Steps
It is recommended to set the allowance to zero before increasing the allowance and use safeApprove/safeIncreaseAllowance.
Lines of code
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BaseBranchRouter.sol#L160-L176
Vulnerability details
Impact
Unsafe ERC20 approve that do not handle non-standard erc20 behavior. Some token contracts do not return any value. Some token contracts revert the transaction when the allowance is not zero.
Proof of Concept
When receiving tokens to the destination chain, the token attempts to approve the destination port address.
For a token like USDT, the token needs to be approved to zero first before calling approve. This may cause a problem in the case of multiple token transfers, and because usdt is not approve, the other tokens may be stuck in the transfer process
Since the omnichain uses all sorts of tokens, it is important that the weird ERC20 tokens are counted as well.
Tools Used
VSCode
Recommended Mitigation Steps
It is recommended to set the allowance to zero before increasing the allowance and use safeApprove/safeIncreaseAllowance.
Assessed type
Other