Skip to content
Business logic Audit finding Beginner

M-12 Unsafe ERC20 operations

The contracts call ERC20 transferFrom directly, which fails for tokens like USDT that do not return a boolean. This causes deposits to revert for those tokens.

c4lanky Follow

Originally disclosed on Code4rena

Submitted by c4lanky

Note: this finding was reported via the winning Automated Findings report. It was declared out of scope for the audit, but is being included here for completeness.

Certain tokens may not adhere to the ERC20 standard completely, yet they are generally accepted by most code designed for ERC20 tokens. An instance of this is Tether (USDT), where the transfer() and transferFrom() functions on L1 do not conform to the specification’s requirement of returning booleans; instead, they have no return value.

Consequently, when such tokens are cast to IERC20, their function signatures do not align, leading to reverted calls (refer to this link for a test case). To mitigate this issue, it is recommended to utilize OpenZeppelin’s SafeERC20’s safeTransfer() and safeTransferFrom() functions instead.

There are 2 instances of this issue: File: contracts/ARCDVestingVault.sol

201:         token.transferFrom(msg.sender, address(this), amount);

https://github.com/code-423n4/2023-07-arcade/blob/main/contracts/ARCDVestingVault.sol#L201

File: contracts/NFTBoostVault.sol

657:         token.transferFrom(from, address(this), amount);

https://github.com/code-423n4/2023-07-arcade/blob/main/contracts/NFTBoostVault.sol#L657

PowVT (Arcade) confirmed


The original report as published on Code4rena, by c4lanky. 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 IERC20 transferFrom interface, which assumes the token returns a boolean, but some tokens do not.

Impact

Deposits using non-standard ERC20 tokens such as USDT would revert, preventing users from using those tokens with the vaults.

What the attacker needed

Token does not return boolean on transfer; user deposits that token

The fix

The code should use OpenZeppelin's SafeERC20 safeTransfer and safeTransferFrom functions instead of direct transferFrom calls.

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 full ERC20 standard because their transfer functions do not return a true/false value. The code expects that return value, so calls to these tokens fail and the transaction is undone. Using a safe transfer helper avoids this problem.

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 c4lanky

View all

3 more disclosed reports, best first.

More from Arcade.xyz

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.