RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: medium
Valid

Lack of update in contribution.amount and no check for amount in contribute function

Summary:

Hi,

I have found out a potential bug in which the users contribution amount doesn't update leads to incorrect refund amount and also, the function does not validate the amount.

Vulnerability Details:

The key details of this potential vulnerability are given as follows:

The contribute function does not update the contribution.amount field when a user contributes. This means the contribution amount is not tracked accurately, which affects the refund function's ability to refund the correct amount.

The contribute function does not validate that the amount is greater than zero.

Impact:

  • Contributors may not be able to refund their contributions correctly, leading to loss of funds.

  • Contributing zero SOL is meaningless and could lead to unnecessary on-chain storage and computation costs.

Tools Used:

Manual review

Recommendations:

  • update the contribution.amount field in the contribute function.

  • Ensure the amount is greater than zero.

Updates

Appeal created

bube Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Contribution amount is not updated

[Invalid] Lack of minimal `amount` in `contribute` function

If user contributes 0 SOL, the `contribution.amount` will be updated with 0 value. There is no impact on the protocol. Also, the new contributers should pay for account creation, therefore there is no incentive someone to create a very huge number of accounts to contribute zero amount.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.