buySnow lets a user pay either in native ETH (exact fee) or in WETH. The branch is chosen by comparing msg.value to the exact ETH price:
The else branch is reached by any msg.value that is not exactly s_buyFee * amount â including a non-zero but wrong ETH amount. In that branch the contract pulls the full WETH price and silently keeps whatever ETH the caller sent. There is no refund path; the stray ETH can only ever be swept out later by the fee collector via collectFee. So a user who sends a non-matching, non-zero ETH value while also having WETH approved both pays in WETH and loses the ETH they attached.
Likelihood: Low â requires the specific combination of (a) sending a non-exact, non-zero msg.value and (b) having a WETH allowance set, i.e. a user mistake rather than something an attacker triggers for others.
Impact: Medium â the user suffers a direct, unrecoverable (to them) loss of the ETH they attached, on top of paying the full WETH price.
A user can be double-charged and lose funds: they pay the full WETH price and forfeit the ETH they mistakenly attached, with no refund and no user-accessible recovery (only the collector can withdraw it).
The following Foundry test passes. The user has WETH approved and mistakenly attaches 0.5 ETH (not equal to the exact fee), so the else branch runs: the full WETH is pulled and the 0.5 ETH is stranded in the contract with no refund.
Observed log: F4 CONFIRMED: user paid WETH and lost stray ETH (wei) = 500000000000000000.
Only take the WETH path when no ETH is attached, and reject/refund any non-matching ETH:
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.