Snow.collectFee()
The collectFee()
function allows the s_collector
to collect all WETH and ETH held by the contract. It does this by calling the transfer()
function on the WETH token and then sending the native ETH via a low-level call
.
The contract does not protect the collectFee()
function against reentrancy attacks. Because it uses a low-level call
to send ETH directly to the s_collector
, a malicious contract can exploit this by reentering the collectFee()
function (or other vulnerable external functions) during the fallback execution, draining ETH or disrupting the logic.
The s_collector
can be a contract, and nothing prevents it from being a malicious one.
As soon as collectFee()
is called and ETH is transferred via call
, the fallback function of the recipient contract can reenter the collectFee()
function or another vulnerable function.
An attacker can recursively call collectFee()
to drain ETH from the contract before the function finishes executing.
It may also interfere with any future logic or upgrade mechanisms that depend on internal state updates happening after the ETH transfer.
Hereβs a minimal malicious contract that can exploit the vulnerability if set as the s_collector
:
β Set
s_collector = MaliciousCollector
, then callattack()
to recursively drain ETH.
Import OpenZeppelinβs ReentrancyGuard
:
Apply nonReentrant
to the vulnerable function:
Move ETH transfer logic to the end of the function and update state before external interactions, if applicable.
Always protect external ETH transfers with reentrancy guards.
Favor call
with caution and ensure minimal logic is executed after external calls.
Restrict sensitive roles like s_collector
to EOAs or audited contracts.
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.
The contest is complete and the rewards are being distributed.