You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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(addresstoken, addressto, uint256amount) 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
The text was updated successfully, but these errors were encountered:
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
0xLeveler
Medium
using
transfer
will causerescueToken
to fail for some tokensSummary
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
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 permanentlyImpact
some tokens will be stuck permanently in the contract
PoC
No response
Mitigation
use safeERC20 and
safeTransfer
for token transfers instead oftransfer
The text was updated successfully, but these errors were encountered: