The collectFee() function collects all WETH tokens and native ETH held by the contract and sends them to the collector address. It assumes that the full balance of WETH can be successfully transferred to s_collector using the standard transfer() method.
However, the function does not account for weird, non-standard ERC20 tokens which may behave differently. These include:
Fee-on-Transfer Tokens which deduct a fee during transfer,
Rebase Tokens which automatically adjust balances,
ERC777 Tokens which can trigger hooks and reentrancy,
Blacklisting Tokens which may restrict transfers based on the sender/recipient.
Likelihood:
When the token address given as WETH is non-standard (e.g., a fee-on-transfer token or ERC777),
When s_collector is blacklisted or recipient balance changes due to a rebase mid-transaction,
Impact:
Loss of funds due to partial or failed transfers that go unnoticed,
Reentrancy vulnerability via ERC777 hooks,
Failed transactions due to transfer restrictions or changes in balance logic.
Fee-on-transfer token: Only amount - fee is received by s_collector, meaning i_weth.balanceOf is not equal to transferred amount. Silent fund loss.
Rebase token: Balances can change between the balanceOf call and the transfer() call. Can result in over/under sending.
ERC777 token: Can re-enter into collectFee() if s_collector is a contract implementing tokensReceived(). Leads to reentrancy vulnerabilities.
Blacklisting token: Transfer fails if s_collector is blacklisted. Results in permanent locking of funds in the contract.
Also consider implementing reentrancy guards around ETH and token transfers to further harden the contract against ERC777-based attacks.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.