RustFund

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

Contributor not being credited after donation.

Summary

amount not being accounted when the contributor sends money to the crowdfunding.

Vulnerability Details

https://github.com/CodeHawks-Contests/2025-03-rustfund/blob/main/programs/rustfund/src/lib.rs#L34-L38

in the contribute function contribution.amount is being set to 0 but should be set to the parameter amount, like this the amount is not being accounted to the contributor but the value is being sent.

// Initialize or update contribution record
if contribution.contributor == Pubkey::default() {
contribution.contributor = ctx.accounts.contributor.key();
contribution.fund = fund.key();
contribution.amount = 0;
}

Impact

contributor not being credit for the donation and in case the crowdfunding never hit the goal he can't get his money back.

Tools Used

manual

Recommendations

contribution.amount += amount should be used instead or a safer way of adding two numbers.

Updates

Appeal created

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

Contribution amount is not updated

Support

FAQs

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