The Snow token utilises a global timer variable (s_earnTimer
) that is shared across all users, creating a severe vulnerability where any user's action blocks all other users from earning tokens. This fundamentally breaks the intended weekly earning mechanism.
The Snow contract implements a token earning mechanism meant to allow users to earn one token per week. However, this functionality is built around a single global timer variable (s_earnTimer
) rather than tracking time on a per-user basis. Any user who calls either buySnow()
or earnSnow()
resets this global timer, preventing all other users from earning tokens for an entire week.
The contract behaves as follows:
When a user calls earnSnow()
, the function checks if the global timer plus one week has passed
If the time has passed, the user earns a token and resets the global timer for everyone
The buySnow()
function also resets this global timer, regardless of whether tokens are purchased
As a result, only one user across the entire protocol can earn tokens in any given week
This creates a scenario where a malicious user can permanently prevent others from earning tokens by consistently resetting the timer before others can use it, effectively launching a denial of service attack against the token earning mechanism.
Likelihood: High
Triggered by normal contract usage
No special conditions or privileges required
Will occur whenever multiple users attempt to use the contract as intended
Impact:
Impact: High
Completely breaks the core token earning functionality
Allows malicious users to prevent others from earning tokens
Creates an unfair and unpredictable user experience
Only one user per week globally can earn tokens
The following test demonstrates how one user's action prevents another user from earning tokens due to the global timer:
1. Replace the global timer with a per-user mapping:
2. Remove the timer update from buySnow()
entirely:
This fix allows each user to earn tokens on their individual weekly schedule without affecting others, restoring the intended functionality of the token earning mechanism.
When buySnow is successfully called, the global timer is reset. This inadvertently affects the earning of snow as that particular action also depends on the global timer.
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.