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

0xLeveler - using transfer will cause rescueToken to fail for some tokens #181

Open
sherlock-admin2 opened this issue Nov 30, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link

sherlock-admin2 commented Nov 30, 2024

0xLeveler

Medium

using transfer will cause rescueToken to fail for some tokens

Summary

the idea of the rescueToken function is to withdraw ERC20 tokens that may have been accidentally sent to the contract,when using transfer, if the return value of the transfer is not checked, it is possible that the transfer fails silently (returning a false ).

Root Cause

tokens that do not return boolean will fail when called with rescueToken

https://github.com/sherlock-audit/2024-11-nounsdao/blob/main/nouns-monorepo/packages/nouns-contracts/contracts/StreamEscrow.sol#L293

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

  1. admin calls rescueToken to withdraw ERC20 that were accidentally sent to the contract, if these include some weird ERC20s, the function will not serve it's purpose, and the funds will be stuck permanently
    function rescueToken(address token, address to, uint256 amount) external onlyDAO {
        IERC20(token).transfer(to, amount);
    }

Impact

some tokens will be stuck permanently in the contract

PoC

No response

Mitigation

use safeERC20 and safeTransfer for token transfers instead of transfer

@sherlock-admin4 sherlock-admin4 changed the title Festive Peanut Shetland - using transfer will cause rescueToken to fail for some tokens 0xLeveler - using transfer will cause rescueToken to fail for some tokens Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant