RustFund

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

Anyone can call refund in ` pb fun refund `

Summary

The function lacks an ownership check, allowing anyone to call refund on behalf of a contributor. Without verifying that the refund is being requested by the original contributor, an attacker could steal someone else's refund.

Vulnerability Details

A malicious user can call the refund function and get a refund on behalf of another contributor. The function does not check if ctx.accounts.contributor.key() matches ctx.accounts.contribution.contributor

Impact

Users can lose their refund if attacker claims it first.

Tools Used

Manual

Recommendations

Ensure that only the original contributor can claim their refund:

if ctx.accounts.contributor.key() != ctx.accounts.contribution.contributor {
return Err(ErrorCode::UnauthorizedRefund.into());
}
Updates

Appeal created

bube Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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