Description:
In the original
refund
function, thecontribution.amount
is reset to 0 after transferring lamports from the fund to the contributor. If the transaction fails (e.g., due to insufficient funds or an overflow) after the transfers but before the reset, the state becomes inconsistent: the contributor receives funds, butcontribution.amount
remains non-zero, potentially allowing a doublerefund
.
Impact:
This could lead to financial loss for the program, as a contributor might repeatedly claim refunds for the same contribution, exploiting the inconsistency. It also complicates auditing and state tracking.
Proof of Concept:
Contributor calls refund with contribution.amount = 1000.
Lamports are transferred: fund loses 1000, contributor gains 1000.
Transaction fails (e.g., checked_add overflows) after transfers but before contribution.amount = 0.
State shows contribution.amount = 1000, despite funds being moved.
Contributor calls refund again, claiming another 1000 lamports.
Recommended Mitigation:
Update state before transfers:
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.