The set_deadline function (lines 55-63) checks if fund.dealine_set on line 57 to prevent the deadline from being changed. However, the function never sets fund.dealine_set = true after setting the deadline.
pub fn set_deadline(ctx: Context
let fund = &mut ctx.accounts.fund;
if fund.dealine_set {
return Err(ErrorCode::DeadlineAlreadySet.into());
}
fund.deadline = deadline;
// Missing: fund.dealine_set = true;
Ok(())
}
Since dealine_set starts as false (line 20) and is never changed to true, the creator can call set_deadline an unlimited number of times. This allows a malicious creator to:
Set a short deadline to attract contributors
As the deadline approaches and the goal isn't met, extend the deadline
Repeat indefinitely, preventing contributors from ever getting refunds
Wait until enough contributions accumulate, then withdraw (since withdraw has no checks)
Creator creates fund, sets deadline to 7 days
Contributors contribute SOL expecting a 7-day campaign
On day 6, creator calls set_deadline with 30 days — succeeds because dealine_set is still false
Contributors cannot refund because the new deadline hasn't passed
Creator extends deadline again on day 29
This cycle can continue forever
Add the missing flag update:
fund.deadline = deadline;
fund.dealine_set = true;
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.