The intended behavior of the earnSnow
function is to allow any user to mint one S
token. This action is subject to a one-week cooldown period that should be tracked individually for each user, allowing them to claim a token once per week, irrespective of other users' actions. The buySnow
function also interacts with this timer, resetting it for the user who makes a purchase.
The contract incorrectly implements the cooldown mechanism using a single global state variable, s_earnTimer
. Consequently, when any user successfully calls earnSnow
or buySnow
, this global timer is reset for the entire contract. This design flaw allows a malicious actor to perpetually prevent all other users from claiming tokens by calling earnSnow
just before the one-week cooldown expires, effectively creating a permanent Denial of Service (DoS) on a core feature of the protocol.
Reason 1: This denial of service occurs whenever a malicious actor (or any user) executes a transaction on the earnSnow function just before the global one-week cooldown expires. The cost to perpetrate this attack is minimal, limited only to the gas fee of a single transaction per week, making it both cheap and simple to execute repeatedly.
Reason 2: The exploit requires no special permissions, roles, or specific contract state to be successful. Any standard Ethereum account can execute the attack at any time after the initial cooldown period, making the attack vector permanently and publicly accessible from the moment of deployment.
Impact 1: The core utility of the earnSnow function is completely neutralized for all legitimate users. This permanently prevents them from minting their weekly tokens, fundamentally breaking the protocol's intended token distribution model and rendering a key feature of the ecosystem useless.
Impact 2: The vulnerability causes a severe loss of user confidence and irreparably damages the project's reputation. The inability to secure a fundamental mechanism will deter new participants and likely cause existing users to lose faith in the protocol's integrity, potentially leading to a collapse in token value and community engagement.
To resolve this critical vulnerability, the contract must be modified to track each user's cooldown period individually. This is achieved by replacing the single global s_earnTimer
state variable with a mapping
that associates each user's address with the timestamp of their last claim.
This ensures that one user's action (calling earnSnow
or buySnow
) does not affect any other user's ability to do the same, completely eliminating the Denial of Service vector.
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.