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

tibthecat - Unsafe usage of ERC20 transfer #391

Closed
sherlock-admin opened this issue May 5, 2023 · 0 comments
Closed

tibthecat - Unsafe usage of ERC20 transfer #391

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

tibthecat

medium

Unsafe usage of ERC20 transfer

Summary

Some ERC20 transfers could fail without reverting, engendering loss of funds.

Vulnerability Detail

Some ERC20 tokens don't revert when transfer fails, they may return a boolean or do nothing (see USDT or ZRX tokens).
And ERC20 unsafe transfer function is used 2 times in the footium codebase.

In FootiumEscrow.sol:

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

And in FootiumPrizeDistributor.sol:

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

Impact

In FootiumPrizeDistributor.sol, if the transfer fails, without reverting, the contract state will assume that prize has been claimed, hence a loss of funds for the prize claimer.

In FootiumEscrow.sol, if the transfer fails witjout reverting, the user might think he has transfered the tokens whereas he has not which could engender some troubles.

Note: In these two cases, if the token used is the FootiumToken there is no risk, but FootiumPrizeDistributor.sol and FootiumEscrow.sol can manage any ERC20 token and it is not written in the documentation that FootiumToken will be the only token that might be used by these contracts.

Code Snippet

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

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

Tool used

Manual Review

Recommendation

Use OpenZeppelin's SafeERC20 library so that failed transfers would revert.

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