The contribute function in the current implementation accepts any contribution amount > 0 (implied by u64, though 0 might also be accepted if not checked). Crucially, it lacks a Minimum Contribution Amount enforcement (e.g., amount >= MIN_AMOUNT).
Allowing extremely small contributions (e.g., 1 lamport) exposes the protocol and its users to "Dusting Attacks" and "Resource Exhaustion":
State Bloat: If the protocol creates a new PDA (Program Derived Address) receipt for every contribution, an attacker can generate millions of accounts with 1 lamport each. This bloats the blockchain state and may hit per-program quotas or slow down indexers.
Event Spam: It allows cheap flooding of the program's event log, making it difficult for off-chain systems to track legitimate activity.
Economic Griefing: The cost of processing these transactions (compute) might outweigh the value they bring, degrading the overall system efficiency.
Severity: Medium
Likelihood: High
Impact: Low
Impact Details:
Operational degradation: Indexers and UIs may crash or slow down attempting to load thousands of dust events.
Storage Costs: If the contract pays for rent (or refunds it improperly), this could drain the operational treasury.
The following solana-program-test demonstrates how an attacker can loop through multiple "dust" transactions.
Define a reasonable minimum constant (e.g., 0.01 SOL) and enforce it at the beginning of the contribute instruction.
1. Define Constant:
Add const MIN_CONTRIBUTION: u64 = ...
2. Enforce Check:
Add require!(amount >= MIN_CONTRIBUTION, ...)
Code Diff:
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.