According to the ERC20 standard, the `transfer()` function returns a boolean value indicating success or failure. Some ERC20 tokens return `false` on failure instead of reverting. The Snow contract's `collectFee()` function ignores the return value of `i_weth.transfer()`, allowing the transfer to silently fail while the function continues execution as if the transfer succeeded.Describe the normal behavior in one or more sentences.
collectFee() Can Silently Fail and Lock WETHakovachev7
According to the ERC20 standard, the transfer() function returns a boolean value indicating success or failure. Some ERC20 tokens return false on failure instead of reverting. The Snow contract's collectFee() function ignores the return value of i_weth.transfer(), allowing the transfer to silently fail while the function continues execution as if the transfer succeeded.
The contract inconsistently handles ERC20 transfers:
Uses SafeERC20.safeTransferFrom() in buySnow()
Uses raw transfer() without checking return value in collectFee()
In Snow.sol:
The contract already imports and declares using SafeERC20 for IERC20 but fails to use it consistently in collectFee().
Likelihood:
Medium: This depends on the specific WETH implementation used. Standard WETH implementations typically revert on failure, but
Some WETH variants or wrapped token implementations may return false instead
If the contract is deployed on different chains with different WETH implementations, behavior may vary
Future upgrades or changes to the WETH contract could introduce this behavior
Edge cases like blacklisted addresses or paused contracts could trigger silent failures
Impact:
High: When a transfer silently fails
WETH tokens remain permanently locked in the Snow contract
The collector believes fees were collected successfully (no revert)
ETH portion is transferred correctly, creating accounting inconsistencies
No mechanism exists to retry or recover the stuck WETH
Accumulated fees over time could represent significant value loss
The collector has no way to detect the failure without manually checking balances
Impact 2
The test demonstrates that when WETH transfer returns false, the function completes successfully while leaving WETH tokens stuck:
Expected behavior: If WETH transfer fails, the function should revert and prevent partial fee collection.
Use the SafeERC20 library that is already imported and configured in the contract. Replace the raw transfer() call with safeTransfer():
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.