The contribute function in the RustFund program fails to update the contribution.amount field after a successful contribution. This leads to a critical issue where the refund functionality becomes completely broken, as it relies on this value to determine how much SOL to return to contributors.
User A creates a fund using fund_create
User B contributes 1 SOL to the fund using contribute
The contribute function transfers the SOL to the fund account and updates fund.amount_raised
However, contribution.amount remains at 0 because it's never updated
When User B tries to get a refund using refund, the function uses contribution.amount (which is 0)
The refund function attempts to subtract 0 SOL from the fund and add 0 SOL to the contributor
User B receives no refund despite having contributed 1 SOL
This issue is critical as it prevents users from getting their contributions refunded, effectively locking their funds in the contract.
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.