After performing successful withdrawals and refunds, the program does not update the fund's amount_raised
confusing the state.
Both functions remove some amount of SOL from the program to either the creator or the contributor. However, both functions fail to update the state of fund.amount_raised
. Whenever tokens are removed from the program, the raised_amount
will not reflect this change.
It confuses the state of the program and user will see overinflated information about the program.
Scenario
Contributor gets a refund since the goal has not been reached (assuming it is coded properly - see other reports)
Lamports are removed from the program. amount_raised
is not updated
Goal is later met. Creator attempts to withdraw funds (assuming this is also coded properly - see other reports)
Program does not have enough lamports to cover the amount_raised
shown by the Fund struct.
For these reasons I qualify this vulnerability as high.
Manual review.
Update the amount_raised in both withdraw()
and refund()
with the amount being removed from the program.
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.