RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: high
Invalid

wrong conditional check in the `contribute` function

Summary

contribute function executes wrong conditional.

Vulnerability Details

the contributefunction is incorrect because we need to check if the deadline exists and is in the future to NOT revert but it's checking if deadline is not zero and is in the past return error.

https://github.com/CodeHawks-Contests/2025-03-rustfund/blob/main/programs/rustfund/src/lib.rs#L29-L31

if fund.deadline != 0 && fund.deadline < Clock::get().unwrap().unix_timestamp.try_into().unwrap() {
return Err(ErrorCode::DeadlineReached.into());
}

Impact

wrong logic that breaks the program.

Tools Used

manual

Recommendations

should check if the deadline exists and is in the future instead.

Updates

Appeal created

bube Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

[Invalid] Contributions are allowed before the deadline is initialized.

There is no problem users to contribute to a given campaign before the deadline is initialized. The issue is when the users refund before the deadline is set.

Support

FAQs

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