The contribute
function allows zero-value contributions, enabling attackers to execute transactions that update state and consume compute units without transferring any funds. This inefficiency can be exploited to create spam transactions, bloating the Solana blockchain state, increasing operational costs, and indirectly leading to a denial-of-service (DoS) risk.
Zero-Value Contributions Allowed: The function does not check whether amount > 0, allowing transactions that update state and consume compute resources without transferring any funds.
State Pollution: Every transaction unnecessarily writes to the Contribution account, increasing storage costs and making state reads slower over time.
Compute Budget Exhaustion: Attackers can flood the network with zero-value transactions, consuming valuable compute units and reducing throughput for legitimate users.
Spam Transactions:
Attackers can generate a large number of zero-value contributions, increasing the blockchain storage and clogging the network.
Denial of Service (DoS) Risk:
Since each transaction consumes compute units, an attacker could slow down or disrupt legitimate user interactions.
Unnecessary On-Chain State Growth:
Since contributions are stored on-chain, excessive spam increases the cost of maintaining and interacting with the contract.
Anchor Tests: To simulate zero-value contributions and analyze execution costs.
The following test demonstrates how an attacker can repeatedly submit zero-value contributions, executing transactions that update state without transferring funds. The program fails to reject these contributions, allowing infinite spam transactions.
The transaction executes successfully and contribution account updates incorrectly, showing a recorded contribution despite sending 0 SOL.
Option One: reject zero-value contributions
Option Two: Set a minimum contribution threshold
If user contributes 0 SOL, the `contribution.amount` will be updated with 0 value. There is no impact on the protocol. Also, the new contributers should pay for account creation, therefore there is no incentive someone to create a very huge number of accounts to contribute zero amount.
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.