Skip to content
Business logic Audit finding Intermediate

TokenHandler.safeTransferIn does not work on non-standard compliant tokens like USDT

The TokenHandler.safeTransferIn function uses the standard IERC20 transferFrom, which expects a boolean return value. For non-standard tokens like USDT that do not return a value, the call reverts, breaking withdrawals for those tokens.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The TokenHandler.safeTransferIn function uses the standard IERC20 function for the transfer call and proceeds with a checkReturnCode function to handle non-standard compliant tokens that don’t return a return value. However, this does not work, as calling token.transferFrom(account, amount) already reverts if the token does not return a return value, as token’s IERC20.transferFrom is defined to always return a boolean.

When using any non-standard compliant token like USDT, the function will revert. Withdrawals for these tokens are broken, which is bad as USDT is a valid underlying for the cUSDT cToken.

We recommend using OpenZeppelin’s SafeERC20 versions with the safeApprove function that handles the return value check as well as non-standard-compliant tokens.

jeffywu (Notional) confirmed

The original report as published on Code4rena, by cmichel. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

Likely the code calls the standard IERC20.transferFrom which is defined to return a boolean, so tokens that return nothing cause a revert before any return-code check can run.

Impact

Withdrawals for non-standard tokens such as USDT are broken, which is significant because USDT is a valid underlying for cUSDT.

What the attacker needed

Non-standard token like USDT; withdrawal of that token

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 tokens, like USDT, do not follow the usual rule of returning a true/false value when you transfer them. The code here assumes every token does return that value, so when it tries to move USDT it fails and the withdrawal cannot happen.

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.

More by cmichel

View all

196 more disclosed reports, best first.

More from Notional contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.