The += operator on u64 wraps silently in Rust release builds when overflow-checks is not enabled in Cargo.toml.
In contribute(), the line fund.amount_raised += amount uses unchecked addition. In a Solana program compiled without overflow-checks = true in the release profile (the Anchor default does not set this), arithmetic overflow wraps silently. An attacker contributing exactly u64::MAX - current_amount_raised + 1 lamports causes amount_raised to wrap to 0 or a tiny value, making a fully-funded campaign appear empty and enabling refunds that should be blocked.
Likelihood:
Reaching u64::MAX lamports (~18.4 billion SOL) through natural contributions is economically impossible under the current SOL supply
A targeted attacker with sufficient SOL (or one exploiting another vulnerability to manipulate the counter) could deliberately craft the wrap
Impact:
amount_raised wrapping to 0 makes a fully-funded campaign appear empty, denying the creator a legitimate withdrawal
Contributors on a successfully-funded campaign could incorrectly claim refunds if goal checks compare against the wrapped value
Inconsistency between the true lamport balance and amount_raised disrupts all program logic depending on this counter
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.