RustFund

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

Refund Logic Issues

Summary

The refund function has multiple logical flaws, including not updating amount_raised and allowing multiple refunds.

Vulnerability Details

  • fund.amount_raised isn’t decreased during a refund.

  • No check prevents refunding more than contributed (since amount isn’t validated against available funds).

  • A contributor could call refund repeatedly if contribution.amount isn’t properly managed.

Impact

Fund state becomes inconsistent (showing more raised than available).

Contributors could drain the fund beyond their contributions.

Tools Used

Manual Code Review

Recommendations

Revise refund:

if contribution.amount == 0 {
return Err(ErrorCode::InsufficientFunds.into());
}
fund.amount_raised = fund.amount_raised
.checked_sub(amount)
.ok_or(ErrorCode::InsufficientFunds)?;
Updates

Appeal created

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

`amount_raised` not updated in `refund` function

Support

FAQs

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