A critical vulnerability has been identified in the RustFund crowdfunding platform. The contribute
function fails to track individual contribution amounts properly, which causes users to lose funds when requesting refunds. This is a high-severity issue that could lead to permanent loss of user funds.
The RustFund smart contract has a critical accounting error in the contribute
function. While the contract correctly tracks the total amount raised in the fund, it fails to update individual contribution records. When a user requests a refund, the contract only returns the amount stored in their contribution record, which remains at 0 (or its initial value).
Attack Path:
A user creates a new contribution by calling the contribute
function
The contract tracks the total amount_raised
but fails to update contribution.amount
The user attempts to get a refund by calling the refund
function
The refund function uses contribution.amount
(which is still 0) to determine the refund amount
The user receives 0 SOL back despite having contributed funds
Impact
Fund Theft: When users request refunds, they will only get back the amount stored in their contribution record (0 SOL), not their actual contributed amount. This effectively allows the smart contract to keep all contributed funds.
Locked Funds: All contributions become permanently locked in the contract if the deadline is reached, as the refund function can only return the tracked contribution amount.
Trust Violation: The crowdfunding platform advertises a refund mechanism that doesn't work, misleading users about the safety of their contributions.
Static code analysis of Solana/Anchor Rust program
Manual review of fund management functions
Add the missing tracking code to the contribute
function:
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.