The buySnow function in Snow.sol checks if the msg.value is strictly equal to the required cost (s_buyFee * amount). If it matches, the user pays in native ETH. If it does not match, the contract assumes the user is paying in WETH and transfers WETH from their balance. However, if the user sent native ETH that does not perfectly match the required cost (e.g., sending excess ETH), the contract takes their WETH but does not refund the sent msg.value.
Medium Likelihood, High Impact: Users interacting with the contract via a misconfigured front-end or making minor calculation errors will permanently lose their sent ETH, as there is no mechanism to rescue or refund it.
File: src/Snow.sol
Exploit Execution:
The buyFee is 5 ether.
A user mistakenly attaches 6 ether of native ETH as msg.value while having 5 WETH in their wallet.
The contract evaluates msg.value == (s_buyFee * amount) (6 ether == 5 ether), which returns false.
The contract proceeds to the else block, taking 5 WETH from the user.
The 6 ether in native ETH remains locked inside the Snow contract forever.
Explicitly check msg.value and refund any excess ETH, or ensure that the user either pays entirely in ETH or entirely in WETH, but not both concurrently.
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.