RustFund

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

Creators can withdraw funds at anytime, even before the goal is reached

Summary

The creator of the fund can withdraw money at anytime. Wheter it is before the deadline or if the goal was reached.

Vulnerability Details

The withdrawfunction https://github.com/CodeHawks-Contests/2025-03-rustfund/blob/main/programs/rustfund/src/lib.rs#L90 ds

Impact

This goes against the rules of the fundraising campaing. Fund creators can rekt users at anytime.

Tools Used

Manual review

Recommendations

Implement a check in the withdraw function

// pseudo code
if accounts.fund.amount_raised < accounts.fund.goal {
return Err("Goal not reached")
}
if current_timestamp < accounts.fund.deadline {
return Err(ErrorCode::DeadlineNotReached.into());
}
Updates

Lead Judging Commences

bube Lead Judge
6 months ago

Appeal created

bube Lead Judge 6 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.