RustFund

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

Improper State Transition in Withdrawal

Summary

The withdraw function updates the campaign state (is_active) after the transfer operation, risking multiple withdrawals if the transfer fails mid-execution

Vulnerability Details

In program/src/instructions/withdraw.rs, the is_active flag is set to false after the transfer instruction succeeds. If the transfer fails (e.g., due to insufficient funds or network issues) but the transaction partially executes, the campaign could remain active, allowing the owner to attempt withdrawal again

Impact

An attacker or owner could potentially withdraw funds multiple times if the transfer operation fails inconsistently, draining more than the intended total_contributed amount. This undermines the campaign’s financial integrity and contributor trust.

Tools Used

MR

Recommendations

Update the state before the transfer and ensure atomicity

Updates

Lead Judging Commences

bube Lead Judge
5 months ago

Appeal created

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

Support

FAQs

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