Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

Any user can get 1 NFT before staking process (s_earnTimer parameter has not initialized)

Global Cooldown Timer Bypass in earnSnow function

Description

  • The earnSnow function is designed to allow users to earn 1 Snow token once per week. Because of not setting of s_earnTimer parameter,attacker is able to get 1 NFT without doing staking.

// if s_earnTimer is zero,able to mint,s_earnTimer has not initialized
if (s_earnTimer != 0 && block.timestamp < (s_earnTimer + 1 weeks)) {
revert S__Timer();
}
_mint(msg.sender, 1);

Risk

Likelihood:

  • The exploit is highly likely in real-world conditions due to the fully public access to the earnSnow() function, predictable default state (s_earnTimer == 0)

Impact:

  • Anyone able to get 1 NFT without staking

Proof of Concept

function test_GlobalCooldownBypass() public {
vm.prank(user1);
snow.earnSnow(); // Works (s_earnTimer == 0)
assertEq(snow.balanceOf(user1), 1); // there is no time check.
}

Recommended Mitigation

+Replace the single s_earnTimer variable with a per-user mapping
Updates

Lead Judging Commences

yeahchibyke Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.