The withdraw() function lacks a check to ensure that the current time is after the deadline, allowing the host to withdraw funds prematurely.
The withdraw() function allows the host to withdraw all the collected tokens from the contract. However, it does not verify that the current timestamp (block.timestamp) is greater than the deadline. This means the host can withdraw the funds even before the event's deadline, potentially breaking the trust model of the contract.
Premature Withdrawal: The host can withdraw funds before the deadline, potentially leaving participants without the funds being used for the intended purpose (the event).
Breach of Trust: Participants expect the funds to be locked until the deadline, and this vulnerability breaks that trust.
Manual Code Review
Add a check to ensure that block.timestamp is greater than or equal to the deadline:
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.