Skip to content
Business logic Audit finding Intermediate

Manual reward claims use stale accrued balances

The claim_rewards function pays out based on a stored accrued balance without first updating the reward index or recalculating newly earned rewards. As a result, users receive fewer tokens than they have actually earned at the time of the call.

v12 Follow with 4funnds, ht111111 and 3 others

Originally disclosed on Code4rena

Submitted by v12, also found by 4funnds, ht111111, rubencrxz, VictoryGod, and Xeekx

Found by V12

  • contracts/incentives/src/contract.rs #L207

Targets

  • IncentivesContract::claim_rewards

Affected Locations

  • IncentivesContract.claim_rewards: claim_rewards sums stored user_data.accrued values and pays from them without first updating the asset reward index or recalculating newly earned rewards.

Description

claim_rewards computes payouts from the stored user_data.accrued snapshot and then subtracts the claimed amount, but it never settles rewards that accrued after the user’s last handle_action. Unlike claim_all_rewards, it does not call update_asset_reward_index or calculate_user_accrued_rewards before determining total_claimable. As a result, rewards earned between the last balance-changing action and the current claim are omitted from the payout. This causes claim_rewards to systematically underpay relative to the full up-to-date entitlement, including when amount = 0. Depending on later user activity and whether emissions have already ended, the missed accrual may only be recoverable through another state-changing action or may remain stranded on this claim path.

Root Cause

claim_rewards reads user_data.accrued without first calling update_asset_reward_index and calculate_user_accrued_rewards to settle newly earned rewards.

Impact

Users calling claim_rewards can receive fewer reward tokens than they have actually earned at the time of the call. In the best case they must perform an extra balance-changing interaction or switch to claim_all_rewards to recover the gap; if emissions have already ended or no further action occurs, part of the earned rewards can remain unmaterialized.

Proof of Concept

For proof of concept and suggested patch, see the original finding.

The original report as published on Code4rena, by v12. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

claim_rewards reads the stored accrued balance without first calling update_asset_reward_index and calculate_user_accrued_rewards to settle newly earned rewards.

Impact

Users calling claim_rewards can receive fewer reward tokens than they have actually earned; they may need an extra action or claim_all_rewards to recover the gap, or the rewards may remain unmaterialized if emissions have ended.

What the attacker needed

User has accrued rewards; user calls claim_rewards

The fix

claim_rewards should call update_asset_reward_index and calculate_user_accrued_rewards before determining the total claimable amount.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you earn rewards over time, the system keeps a running total. This function pays you based on an old saved total instead of first adding the rewards you earned since your last action. So you get less than you should, and the missing amount might only be recoverable later or not at all.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by v12

View all

37 more disclosed reports, best first.

More from K2

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.