RustFund

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

Withdraw() doesn't implement deadline check

Summary

Withdraw function is not checking if the deadlined has passed

Vulnerability Details

The withdraw function is ignoring the deadline of the fund and allows the creator to withdraw funds whenever they want.

Impact

The specification of the protocol is broken as the funds can be withdrawn by the owner at any point.

Tools Used

Recommendations

Add a deadline check:

if ctx.accounts.fund.deadline != 0 && ctx.accounts.fund.deadline > Clock::get().unwrap().unix_timestamp.try_into().unwrap() {
return Err(ErrorCode::DeadlineNotReached.into());
}
Updates

Appeal created

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

No deadline check in `withdraw` function

Support

FAQs

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