Skip to content
Smart contracts Audit finding Beginner

Unchecked transfers

The smart contracts call ERC20 transfer and transferFrom without checking the returned boolean, so for tokens that return false instead of reverting on failure, airdrop participants could lose their tokens. The report recommends using SafeERC20 to handle non-standard tokens.

Reigada Follow

Originally disclosed on Code4rena

Submitted by Reigada, also found by Ruhum, loop, cmichel, defsec, pauliax, WatchPug, and 0v3rf10w

Impact

Multiple calls to transferFrom and transfer are frequently done without checking the results. For certain ERC20 tokens, if insufficient tokens are present, no revert occurs but a result of “false” is returned. It’s important to check this. If you don’t, in this concrete case, some airdrop eligible participants could be left without their tokens. It is also a best practice to check this.

Proof of Concept

AirdropDistributionMock.sol:132:        mainToken.transfer(msg.sender, claimable_to_send);
AirdropDistributionMock.sol:157:        mainToken.transfer(msg.sender, claimable_to_send);
AirdropDistribution.sol:542:        mainToken.transfer(msg.sender, claimable_to_send);
AirdropDistribution.sol:567:        mainToken.transfer(msg.sender, claimable_to_send);

InvestorDistribution.sol:132:        mainToken.transfer(msg.sender, claimable_to_send);
InvestorDistribution.sol:156:        mainToken.transfer(msg.sender, claimable_to_send);
InvestorDistribution.sol:207:        mainToken.transfer(msg.sender, bal);

Vesting.sol:95:        vestingToken.transferFrom(msg.sender, address(this), \_amount);

PublicSale.sol:224:            mainToken.transfer(\_member, v_value);

Tools Used

Manual testing

Recommended Mitigation Steps

Check the result of transferFrom and transfer. Although if this is done, the contracts will not be compatible with non standard ERC20 tokens like USDT. For that reason, I would rather recommend making use of SafeERC20 library: safeTransfer and safeTransferFrom.

chickenpie347 (Boot Finance) confirmed

The original report as published on Code4rena, by Reigada. 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

Impact

For certain ERC20 tokens, some airdrop eligible participants could be left without their tokens.

What the attacker needed

Token returns false on failure; contract uses transfer without check

The fix

Use the SafeERC20 library's safeTransfer and safeTransferFrom to check results and support 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 tokens don't stop with an error when a transfer fails; they just return false. If the code ignores that false, it thinks the transfer worked when it didn't, so users might not get their tokens. This report points out places where the code ignores the result.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by Reigada

View all

3 more disclosed reports, best first.

More from Boot Finance contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.