Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Koolex - Transferring ERC20 tokens which return a bool value and don't revert on failure will cause loss of funds for the receiver #298

Closed
sherlock-admin opened this issue May 5, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented May 5, 2023

Koolex

medium

Transferring ERC20 tokens which return a bool value and don't revert on failure will cause loss of funds for the receiver

Summary

Transferring ERC20 tokens which return a bool value and don't revert on failure will cause loss of funds for the receiver

Vulnerability Detail

The protocol supports any ERC20 token and use transfer method to transfer the ERC20 token prize to the claimer.
However, some ERC20 tokens do not revert on a failed transfer but only return a bool value (false). In this case, the tx will succeed and totalERC20Claimed is updated although the claimer receives zero amount.

Note: this is also applicable on FootiumEscrow contract although it has less impact since the owner can re-call FootiumEscrow.transferERC20 as many as he/she wants.

Impact

The claimer receives zero amount. totalERC20Claimed is updated for the claimer even though he/she didn't reveive any amount.

Code Snippet

	if (value > 0) {
		totalERC20Claimed[_token][_to] += value;
		_token.transfer(_to, value);
	}

https://github.com/sherlock-audit/2023-04-footium/blob/main/footium-eth-shareable/contracts/FootiumPrizeDistributor.sol#L128-L131

    function transferERC20(
        IERC20 erc20Contract,
        address to,
        uint256 amount
    ) external onlyClubOwner {
        erc20Contract.transfer(to, amount);
    }

https://github.com/sherlock-audit/2023-04-footium/blob/main/footium-eth-shareable/contracts/FootiumEscrow.sol#L110

Tool used

Manual Review

Recommendation

Use a safe transfer from a library like OpenZeppelin SafeERC20 to avoid inconsistent handling of ERC20 transfer

Duplicate of #86

@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels May 10, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant