Submitted by 0x41, also found by ifex445, 0x007, Bauchibred, and 0xaltego
The erc20.go file assumes all ERC20 tokens return a boolean value from transfer operations, but some popular tokens like USDT, BNB, and OMG do not (https://github.com/d-xo/weird-erc20). These tokens are valid ERC20s but do not conform to the current standard of returning a boolean.
When attempting to transfer such tokens, UnpackIntoInterface will call Unpack which fails when there is no return data but a return value is expected in the ABI. This causes the transfer to fail with an error, preventing users from transferring otherwise valid tokens through the system.
As noted in the audit scope, handling of Missing return values is explicitly in scope for this audit.
The issue occurs in erc20.go:91-95:
The underlying Unpack function in the Ethereum ABI encoding will error when attempting to unpack empty return data if the ABI specifies a return value (go-ethereum/accounts/abi/argument.go):
This prevents transfers of tokens like USDT that dont return a value, even when the transfer itself succeeds.
Modify the transfer function to consider a transfer successful if:
This makes the system compatible with both standard ERC20 tokens that return a boolean and non-standard tokens that dont return a value. The approach is similar to that used by established DeFi protocols that need to handle both types of tokens.
berndartmueller (judge) decreased severity to Low and commented:
Lambda (warden) commented:
berndartmueller (judge) increased severity to Medium and commented:
k-yang (Nibiru) acknowledged and commented outside of Github with C4 staff:
