RustFund

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

The fund will still continue to be open for contributions even after the contribution withdrawal

Summary

`lib.rs` implements a functionality where owner can withdraw the contributed funds by the following function

pub fn withdraw(ctx: Context<FundWithdraw>) -> Result<()> {
let amount = ctx.accounts.fund.amount_raised;
**ctx.accounts.fund.to_account_info().try_borrow_mut_lamports()? =
ctx.accounts.fund.to_account_info().lamports()
.checked_sub(amount)
.ok_or(ProgramError::InsufficientFunds)?;
**ctx.accounts.creator.to_account_info().try_borrow_mut_lamports()? =
ctx.accounts.creator.to_account_info().lamports()
.checked_add(amount)
.ok_or(ErrorCode::CalculationOverflow)?;
Ok(())
}

Here, even if the all the funds are withdraws from the fund, it would still continue to be open towards contribution, which is logically incorrect, this will allow the fund creator to get as much fundings as he like.

Impact

The fund will still be continue to work even after a withdrawl

Tools Used

Manual Analysis

Recommendations

Making the fund non-contributable after a withdraw by owner

Updates

Lead Judging Commences

bube Lead Judge
5 months ago

Appeal created

bube Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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