The vulnerability lies in the failure of the contract to update the contribution record’s amount when funds are contributed. As a result, contributors are unable to retrieve their funds through the refund mechanism, even when a campaign does not meet its goal and the deadline is reached. This report outlines the technical details, potential impact, and recommendations for remediation.
Flaw Description:
The core issue is found in the contribute
function, where a new contribution record is initialized with an amount of zero. Instead of updating the record with the contributed amount, the contract merely transfers the SOL from the contributor to the campaign account. Consequently, the refund logic, which relies on the contribution record’s amount to determine the refundable funds, always perceives the amount as zero.
Code Analysis:
The problematic section in the contribute
function is as follows:
The function fails to update contribution.amount
with the transferred amount. When a contributor later attempts to request a refund using the refund
function, the contract checks the contribution record and finds an amount of zero, resulting in no funds being refunded.
Refund Implications:
The refund function is designed to return contributed funds if a campaign fails (i.e., the deadline is reached without meeting the funding goal). However, due to the zeroed contribution amount, even eligible contributors do not receive any reimbursement, leaving their funds effectively locked within the contract.
Financial Loss for Contributors:
Contributors expecting a refund in the event of an unsuccessful campaign will not be able to recover their funds. This creates a direct financial risk for users and undermines the trust in the crowdfunding platform.
Reputation and Trust:
The inability to refund contributions as promised severely damage the platform’s reputation. Trust is a critical component in decentralized crowdfunding, and such vulnerabilities discourage future contributions, hindering the platform’s growth.
Manual Review
Update Contribution Record:
Modify the contribute
function to properly update the contribution.amount
with the contributed funds. For instance, if the record is uninitialized, set it to the contributed amount; if it already exists, increment it accordingly:
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.