RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: high
Valid

No Checks for Deadline or Goal Achievement in `withdraw` function

Summary No Checks for Deadline or Goal Achievement in withdraw function

Vulnerability Details : The withdraw function does not verify if the deadline has passed or if the funding goal was met. This allows the creator to withdraw funds at any time, regardless of whether the funding period has ended or the goal was achieved.

Impact - Creators can withdraw funds before the deadline, potentially before the funding goal is met.

  • This could lead to misuse of funds and loss of trust from contributors.

Tools Used

Recommendations

+ Add checks to ensure the deadline has passed and the goal has been met before allowing withdrawal.
+ let current_time = Clock::get()?.unix_timestamp.try_into().unwrap();if fund.deadline == 0 || fund.deadline > current_time { return Err(ErrorCode::DeadlineNotReached.into());}if fund.amount_raised < fund.goal { return Err(ErrorCode::GoalNotReached.into());}
Updates

Appeal created

bube Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

No deadline check in `withdraw` function

No goal achievement check in `withdraw` function

Support

FAQs

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