RustFund

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

Missing Goal Validation in fund_create

Summary

The fund_create function does not validate the goal parameter, allowing campaigns to be created with a zero goal. This creates illogical campaign states and potential abuse scenarios

Vulnerability Details

the goal parameter (a u64) is assigned to campaign.goal without any checks (e.g., goal > 0). While u64 cannot be negative, a value of zero is meaningless for a crowdfunding campaign and could bypass intended logic, such as withdrawal conditions tied to reaching the goal.

Impact

A campaign with a goal of zero could be exploited by the owner to instantly "meet" the goal and withdraw funds without genuine contributions, confusing contributors or breaking the platform’s trust model.

Tools Used

M L

Recommendations

Add a validation check to the fund_create function to prevent and panic if the goal is zeroed from initialization :

require!(fund.goal > 0, ErrorCode::ZeroGoal);

Updates

Appeal created

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

No minimal amount for the `goal` in `fund_create` is greater than 0

If the `goal` is 0, the campaign goal is achieved immediately and the creator can withdraw the contributors funds. The contributors select themself which campaign to support, therefore I think Low severity is appropriate here.

Support

FAQs

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