TokenManagerERC20.sol uses transferFrom() instead of safeTransferFrom()
The TokenManagerERC20 contract uses transferFrom() instead of safeTransferFrom(), so tokens that do not return a boolean (non-standard ERC20) will cause transactions to revert. This makes such tokens unusable in the protocol, but no funds are lost.
Submitted by jayjonah8, also found by cmichel and IllIllI
Impact
In TokenManagerERC20.sol the _exit() function makes use of transferFrom() instead of using safeTransferFrom(). Tokens that don’t correctly implement the latest EIP20 spec will be unusable in the protocol as they revert the transaction because of the missing return value.
Proof of Concept
Recommended Mitigation Steps
It’s recommended to use OpenZeppelin’s SafeERC20 versions with the safeTransfer and safeTransferFrom functions that handle the return value check as well as non-standard-compliant tokens.
cstrangedk (SKALE) disputed, disagreed with severity and commented:
Issue is acknowledged and work is pending on the roadmap. No loss of funds is possible, only revert txn. In the meantime, SKALE Chain owners at their discretion can expand the bridge compatibility to use safeTransfer functions. Owners must evaluate token compatibility.
GalloDaSballo (judge) decreased severity to Medium and commented:
I believe that given the “need for configuration” the finding cannot be of High Severity. Additionally, the tx will revert as such no loss of funds is possible.
The tokens that will cause a revert (e.g. USDT) will simply be unusable.
While the argument for configuration is correct in de-escalating to Medium, I don’t believe it exempts the code from being properly scrutinized.
If a user were to configure their chain to use TokenManagerERC20 they’d have revert on non returning tokens, for that reason I believe Medium Severity to be appropriate as this is contingent on configuration
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
Root cause
The contract calls transferFrom() directly instead of using a safe wrapper that checks the return value and handles tokens without a return value.
Impact
Tokens that do not return a boolean from transferFrom will cause transactions to revert, making them unusable in the protocol; no loss of funds is possible.
What the attacker needed
Chain configured to use TokenManagerERC20; Token does not return a boolean on transfer
The fix
Use OpenZeppelin's SafeERC20 safeTransfer and safeTransferFrom functions, which handle the return value check and non-standard tokens.
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.
Some older or non-standard tokens do not return a true/false value when you transfer them. The contract expects that return value, so the transfer fails and the whole transaction is undone. This means those tokens cannot be used with this bridge.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.