Severity: High
Category: Economic Integrity / Fund Management
The RustFund
protocol lacks proper state management following withdrawals. Specifically, the amount_raised
remains unchanged even after funds have been withdrawn, allowing ambiguity in campaign state and potentially enabling repeated withdrawals.
The withdraw
function does not update or reset the fund's state after successful withdrawals. This leaves the campaign's amount_raised
unchanged and introduces the risk of improper or duplicate withdrawals, especially if new contributions are made after withdrawal.
Vulnerable Component:
File: lib.rs
Function: withdraw
Struct: Fund
Campaign state ambiguity: The protocol does not clearly indicate whether funds have already been withdrawn.
Risk of multiple withdrawals: Future contributions might trigger further withdrawals due to missing state enforcement.
Economic inconsistency: Protocol state diverges from actual on-chain balances, potentially misleading contributors.
Here's a minimalist and professional PoC for H-03 (Missing Withdrawal State Tracking):
Anchor Framework (JavaScript tests)
Manual Code Review
Explicitly track withdrawal state by updating the Fund
struct and modifying the withdraw
function to ensure proper state transitions:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.