Normal behavior:
The buySnow() function should require users to pay either ETH or WETH equal to s_buyFee * amount in order to mint Snow tokens, ensuring proper fee collection per unit minted.
Issue:
The function lacks safeguards for fee precision and zero-value fee settings. If s_buyFee == 0, minting can be performed for free, breaking protocol economics. Additionally, the comparison msg.value == totalFee lacks precision control and can be exploited with overflows or dust values, particularly on high-magnitude amount inputs.
Likelihood:
High — Exploitable under common owner configurations, especially when fees are misconfigured or maliciously set to zero.
Reproducibility: Reliable under predictable state; exploits do not require edge conditions.
Ease of exploitation: Fee bypass is trivial when set to 0; overflow or dust ETH attack requires minimal technical effort.
Impact:
Unlimited minting: Owner or attacker can mint tokens without paying any ETH or WETH.
Tokenomics failure: Fee model collapses, undermining any value accrual mechanism.
Economic harm: Protocol utility and credibility are compromised by fundless inflation.
Indexing/log misrepresentation: External systems assume payment occurred due to emitted events and state changes.
Explanation:
Fee Bypass: Owner initializes contract with s_buyFee = 0; attacker calls buySnow(1000) with msg.value = 0 and receives tokens.
Precision Exploit: Large amount input can overflow fee calculation or result in successful minting for insignificant payment (e.g., 1 wei).
Ensure s_buyFee > 0 and apply strong payment validation using explicit condition checks and transfer confirmations.
Explanation:
Fixes zero-fee minting: Ensures owner cannot accidentally or maliciously bypass payment enforcement.
Prevents overflow: Total fee calculated with minimal risk of overflow and validated precisely.
Safe WETH path: Confirms actual tokens were transferred using balance delta.
Maintains protocol integrity: Preserves value model and off-chain trust in the payment layer.
This is a high-severity vulnerability due to its potential to destroy protocol economics by enabling free or inaccurate minting. Proper fee validation is fundamental to DeFi protocols. The proposed mitigation preserves backward compatibility and can be deployed with minimal disruption.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.