Normal behavior expects that if a user incorrectly calculates their msg.value and sends the wrong amount of ETH to a payable purchasing function, the transaction should revert to protect their funds.
However, the buySnow function uses an if/else block that checks for exact parity with the required fee. If the user sends ETH (msg.value > 0), but the amount does not exactly equal s_buyFee * amount, the else block automatically triggers. The contract proceeds to keep the wrongfully sent ETH, while simultaneously pulling the full correct required amount in WETH from the user's wallet via safeTransferFrom.
Likelihood:
This will occur whenever an average user misconfigures their transaction value or simply misestimates the required exact ETH cost.
Impact:
Users who submit a transaction with an incorrect msg.value will secretly lose their sent ETH, as it becomes permanently stuck in the contract's balance (until incidentally swept by collectFee()), AND they will be double-charged by having their WETH pulled anyway.
This Proof of Concept shows Alice mistakenly sending 4 ETH to the contract when the total fee required is 5 ETH. Instead of reverting her transaction to protect her, the else block catches it. It doesn't use her 4 ETH, doesn't refund it, and proceeds to completely wipe 5 WETH from her wallet. Alice ultimately loses 9 full tokens of value for a 5-token purchase.
Recommended Mitigation: Restrict the msg.value handling. If msg.value > 0, explicitly demand that it perfectly matches the cost, reverting if it doesn't, so users don't trigger the WETH fallback while sending 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.