Skip to content
Business logic Audit finding Intermediate

No ERC20 safe* versions called

The claim function calls ERC20 transfer without checking the return value, so tokens that return false on failure are treated as successful transfers. Also, tokens like USDT that do not return a boolean cause the transaction to revert, making them unusable in the protocol.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel, also found by JMukesh and hickuphh3

The claim function performs an ERC20 transfer rewardsToken.transfer(to, claiming); but does not check the return value, nor does it work with all legacy tokens.

Some tokens (like USDT) don’t correctly implement the EIP20 standard and their transfer/transferFrom function return void instead of a success boolean. Calling these functions with the correct EIP20 function signatures will always revert.

The ERC20.transfer() and ERC20.transferFrom() functions return a boolean value indicating success. This parameter needs to be checked for success. Some tokens do not revert if the transfer failed but return false instead.

Tokens that don’t actually perform the transfer and return false are still counted as a correct transfer and tokens that don’t correctly implement the latest EIP20 spec, like USDT, will be unusable in the protocol as they revert the transaction because of the missing return value.

Recommend using OpenZeppelin’s SafeERC20 versions with the safeTransfer and safeTransferFrom functions that handle the return value check as well as non-standard-compliant tokens.

alcueca (Yield) confirmed:

True, thanks for spotting it!

alcueca (Yield) patched:

Fix

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

The code uses the standard ERC20 transfer function directly without checking its boolean return value and without handling tokens that do not return a value.

Impact

Tokens that return false on a failed transfer are still counted as transferred, and tokens like USDT that do not return a boolean will cause the transaction to revert, making them unusable in the protocol.

What the attacker needed

None

The fix

The fix was to use OpenZeppelin's SafeERC20 safeTransfer and safeTransferFrom functions, which check the return value and handle 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.

When a smart contract sends tokens, it should check whether the transfer actually succeeded. Some tokens signal failure by returning false instead of stopping with an error, and others do not return anything at all. This code ignores both cases, so failed transfers can look successful and some tokens cannot be used.

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 Yield Witch v2 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.