The buySnow function is designed to allow users to purchase Snow tokens using either ETH or WETH.
However, the function does not validate that msg.value is either zero or exactly equal to the required purchase cost. As a result, any non-zero but incorrect ETH amount causes the function to fall back to the WETH payment path while silently retaining the sent ETH inside the contract.
Likelihood:
Users frequently submit incorrect ETH values due to UI or rounding errors
The issue can occur on every call to buySnow
Impact:
User ETH becomes permanently locked in the contract
Users may unintentionally pay both ETH and WETH for a single purchase
Scenario
The buySnow function allows users to purchase Snow tokens using either ETH or WETH.
The intended behavior is that users either:
Pay exact ETH amount equal to s_buyFee * amount, or
Pay zero ETH and transfer the equivalent amount of WETH.
However, the function does not validate incorrect non-zero msg.value.
As a result, when a user sends an invalid ETH amount, the function silently falls back to the WETH payment path while permanently locking the sent ETH in the contract.
Step-by-Step Attack / Failure Flow
A user attempts to buy Snow using ETH.
Due to UI rounding, fee miscalculation, or manual interaction, the user sends a non-zero msg.value that is not exactly equal to s_buyFee * amount.
The if condition fails.
Execution enters the else branch:
WETH is transferred from the user.
Snow tokens are minted.
The sent ETH is not refunded, reverted, or accounted for.
The ETH remains permanently locked in the Snow contract.
Additionally, consider separating ETH and WETH purchase flows into distinct functions.
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.