RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: medium
Invalid

No Check for Contribution Existence in refund Function

Summary

The refund function does not check if the contribution account exists or if the contributor has actually contributed to the fund. This could allow malicious users to attempt refunds from non-existent or unrelated contributions.

Vulnerability Details

The refund function does not validate the existence of the contribution account:

pub fn refund(ctx: Context<FundRefund>) -> Result<()> {
// No check for contribution existence
}

Impact

user could attempt to refund from a non-existent or unrelated contribution, potentially disrupting the contract's state.

Tools Used

manual review

Recommendations

Add a check to ensure the contribution account exists and is associated with the fund:

if ctx.accounts.contribution.amount == 0 {
return Err(ErrorCode::NoContributionFound.into());
}
Updates

Appeal created

bube Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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