RustFund

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

Withdraw() doesn't check goal

Summary

The withdraw function isn't checking if the fund goal has been met

Vulnerability Details

The creator of the fund can withdraw the funds regardless of whether the funding goal has been reached because there is no check made against the goal before allowing the withdraw.

Impact

This goes against the protocol specification and a creator can choose to disregard the funding goal and withdraw funds as they please before contributors are able to refund their contributions.

Tools Used

Recommendations

Add a check for whether the fund goal is met:

if ctx.accounts.fund.amount_raised < ctx.accounts.fund.goal {
return Err(ProgramError::InsufficientFunds.into());
}
Updates

Appeal created

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

No goal achievement check in `withdraw` function

Support

FAQs

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