Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

beforeDeadline Modifier does not handle all scenarios properly

Summary

The beforeDeadline modifier fails to properly handle scenarios where the deadline is not set (deadlineSet == false).

Vulnerability Details

The modifier does not check if the deadlineSet flag is true. When deadlineSet is false, the comparison block.timestamp > deadline will always fail (as deadline defaults to 0), causing unintended behavior:

  • Actions requiring the beforeDeadline modifier are restricted even though no deadline is set.

  • The modifier performs unnecessary computations even when the deadline is not applicable.

Impact

Functions requiring beforeDeadline may fail even when the deadline is not applicable, locking out legitimate actions.

Tools Used

Manual code review

Recommendations

Include a check for deadlineset:

modifier beforeDeadline() {
if (deadlineSet && block.timestamp > deadline) {
revert BeyondDeadline();
}
_;
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 11 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.