In src/Snow.sol, buySnow(uint256 amount) allows amount == 0 and, when msg.value != s_buyFee * amount, charges the user full WETH via safeTransferFrom without refunding or rejecting non-zero msg.value.
In src/Snow.sol (lines 79–90):
If a user sends msg.value > 0 that is not equal to s_buyFee * amount, the else branch pulls the full fee in WETH while keeping the sent native ETH trapped in the contract (later swept by the fee collector).
Likelihood:
Any user who overpays or underpays native ETH while holding WETH allowance loses both their ETH and WETH, and buySnow(0) succeeds with zero payment.
Impact:
Direct loss of user funds (msg.value double-charged alongside WETH) and zero-cost state manipulation via buySnow(0).
Add the following test to test/TestSnow.t.sol demonstrating how a user is double-charged in both ETH and WETH:
Validate that amount > 0 at the beginning of buySnow() to prevent zero-value calls. When msg.value > 0, require that msg.value == s_buyFee * amount (or revert in the else branch if msg.value != 0) so that users paying with WETH cannot accidentally have their native ETH locked in the contract.
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.