Description:
The buySnow() function checks if msg.value exactly equals the required fee. If not, it falls through to the WETH branch. This means sending partial ETH will NOT use that ETH but instead attempt a WETH transfer. The sent ETH remains stuck in the contract.
Impact:
Users who accidentally send wrong ETH amount lose their ETH
Confusing payment logic leads to unexpected behavior
ETH can become stuck in contract (only collector can withdraw)
Poor user experience and potential fund loss
Likelihood:
Occurs when users make typos in ETH amount
Common UX mistake, especially with decimals
Anyone sending non-exact ETH amount is affected
Impact:
User's ETH stuck in contract (loss of funds)
Only collector can retrieve via collectFee()
User may also have WETH taken if they have allowance
Steps to reproduce:
User tries to buy Snow with slightly wrong ETH amount
Exact match fails, else branch executes
Else branch tries WETH transfer (unexpected)
If WETH transfer succeeds, original ETH is stuck
Run command: forge test --match-test testM03 -vvv
Mitigation explanation:
Add explicit S__InvalidPayment error for clarity
Path 1: Exact ETH match → accept ETH payment
Path 2: Zero ETH sent (msg.value == 0) → use WETH
Path 3: Any other amount → revert with clear error
This prevents accidental fund loss and improves UX
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.