Christmas Dinner

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

Missing State Update in Deadline Setting Mechanism Disrupts Intended Functionality

Summary

The setDeadline function fails to set the deadlineSet boolean to true after setting the deadline, allowing the host to repeatedly change the deadline despite the intended single-use design.

Vulnerability Details

The function contains a check to prevent multiple deadline settings by verifying the deadlineSet boolean

function setDeadline(uint256 _days) external onlyHost {
if(deadlineSet) {
revert DeadlineAlreadySet();
} else {
deadline = block.timestamp + _days * 1 days;
emit DeadlineSet(deadline);
}
}

However, after setting the deadline, the function fails to update deadlineSet to true. This oversight means that:

  1. The check for deadlineSet will always return false

  2. The host can call this function multiple times to change the deadline

  3. The DeadlineAlreadySet() error will never be triggered

Impact

This vulnerability has medium severity because

  • It breaks a core contract invariant that the deadline should only be set once

  • It allows the host to manipulate the deadline multiple times, potentially disrupting participants' planning

  • It could be used maliciously to extend the deadline indefinitely or suddenly shorten it

  • However, it's mitigated by being restricted to the host only (onlyHost modifier)

Tools Used

  • Manual review

Recommendations

Add the missing state update to set deadlineSet = true after setting the deadline:

function setDeadline(uint256 _days) external onlyHost {
if(deadlineSet) {
revert DeadlineAlreadySet();
} else {
deadline = block.timestamp + _days * 1 days;
+ deadlineSet = true; // add this line
emit DeadlineSet(deadline);
}
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

deadline is never set to true

Support

FAQs

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