Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unchecked transfers #31

Open
code423n4 opened this issue Nov 6, 2021 · 0 comments
Open

Unchecked transfers #31

code423n4 opened this issue Nov 6, 2021 · 0 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

Reigada

Vulnerability details

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.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Nov 6, 2021
code423n4 added a commit that referenced this issue Nov 6, 2021
@chickenpie347 chickenpie347 added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

2 participants