Description:
The function setDeadline can be called only by the host, which is the intended behavior. However, the smart contract defines a custom error DeadlineAlreadySet which implies that once the deadline is set, the host should not be able to change it again. The function setDeadline requires the public boolean variable deadlineSet to be false in order to continue the execution. The problem is that this variable is never set to true, therefore allowing multiple reset of the deadline by the host.
Impact:
The severity of the issue depends on whether the host is a malicious actor or not. We tend to assume that the host of the contract should act in the interest of the organization. However, this adds a layer of trust which could be easily broken by the host, extending the deadline and allowing user to withdraw funds even though the original deadline has already been reached.
Tools Used:
Manual review
Proof of Concept:
Add the following test to ChristmasDinnerTest.t.sol. This test should pass, demonstrating that it is possible for the host to reset the deadline multiple times.
Recommended Mitigation:
In case setDeadline should revert after the host has already set the deadline once, the best solution is to set the deadlineSet variable to true right after the necessary timestamp conversion of the new deadline.
In case setDeadline should allow the host to change the deadline multiple times, it is possible to eliminate the if/else statement, as well as the public variable deadlineSet and the custom error DeadlineAlreadySet.
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.