The contribute function updates the fund.amount_raised state variable and the underlying account lamports separately. While Solana transactions are atomic, the lack of explicit synchronization or balance checks allows for potential state desynchronization. Specifically, relying on amount_raised as the source of truth without validating it against the actual lamport balance can lead to accounting discrepancies, especially if the account allows direct lamport transfers (bypass) or if logic errors occur in other parts of the program.
Severity: High
Likelihood: Medium
Impact: High
Impact Details:
State Corruption: The amount_raised counter can become desynchronized from the actual balance.
Accounting Fraud: Discrepancies between actual funds and recorded amounts can be exploited to deny legitimate refunds or allow excess withdrawals.
The following test demonstrates the inconsistency. We simulate a scenario where amount_raised tracks a value different from the actual lamports if a direct transfer occurs (mimicking the lack of strict accounting capability in the simple increment logic).
Enforce a strict check that the final amount_raised matches the actual account balance (minus rent exemption).
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.