Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

comparison excludes the exact threshold value

Summary

  • Function Audited: searchForEgg()

  • Issue: Off-by-one error in egg discovery condition

  • Severity: Low

  • Status: Unresolved


Vulnerability Details

In the following condition:

if (random < eggFindThreshold)

The comparison excludes the exact threshold value. For example, with a 20% chance (eggFindThreshold = 20), only values 0–19 qualify, effectively giving a 19% chance instead of 20%.


Impact

  • Probability Mismatch: Actual chance to find an egg is 1% lower than intended.

  • Game Balance: Slight deviation from expected odds may impact fairness over many attempts.


Tools Used

  • Manual code review


Recommendations

Update the condition to include the threshold value:

if (random <= eggFindThreshold)

This ensures the egg-finding probability exactly matches the configured percentage.


Updates

Lead Judging Commences

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Insecure Randomness

Insecure methods to generate pseudo-random numbers

Support

FAQs

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