Post-exit settlement erases pending incentive rewards
The incentives contract settles rewards using the post-action balance rather than the balance held during the elapsed interval, so a full exit can reduce the settled amount to zero. Users can permanently lose incentive emissions that accrued since their last settlement when they withdraw, repay, transfer, or are liquidated.
Submitted by v12, also found by 0xApple, 0xjoe, 0xterrah, aestheticbhai, Agontuk, ah_mo, akupemulaygbaik, anonymous237, arkheionx, AvantGard, D_Auditor, DemoreX, edoscoba, eta, happykilling, harry, hezze, Hola123, insecuremary, Joseph_Nwodoh, Kalogerone, la-arana-inteligente, lostOpcode, oxwhite, qed, R3D_XplOiT, rienne, Ryo, sh1v, TheSchnilch, and yongskiws
Found by V12
contracts/incentives/src/contract.rs#L71contracts/incentives/src/contract.rs#L207contracts/incentives/src/contract.rs#L369
Targets
- IncentivesContract::handle_action
- IncentivesContract::claim_rewards
- IncentivesContract::claimallrewards
Affected Locations
- IncentivesContract.handle_action:
handle_actioncomputesbalance_for_rewardsasif user_data.balance_snapshot == 0 { 0 } else { user_data.balance_snapshot.min(user_balance) }, even though token flows call it after balances have already been reduced. - IncentivesContract.claim_rewards:
claim_rewardsonly transfers already storedaccruedamounts and does not advance indices, so it cannot reliably crystallize pending rewards before a balance reduction. - IncentivesContract.claimallrewards:
claim_all_rewardsattempts to readscaled_total_supplyasu128even though the token interface returnsi128, causing index advancement to be skipped and removing a practical pre-exit settlement path.
Description
The incentives system accrues rewards lazily, so settlement must use the balance that was actually held during the elapsed interval. Instead, handle_action is called after withdrawals, repayments, transfers, and liquidation-driven balance reductions, and it computes the rewardable amount as min(balance_snapshot, user_balance). That means a balance-reducing action settles the elapsed interval against the reduced post-action balance rather than the prior balance that earned the emissions, and a full exit can reduce the settled amount to 0. The duplicate reports also note that claim_rewards does not advance indices and claim_all_rewards mis-handles scaled_total_supply, so users cannot reliably crystallize pending rewards before the balance drop. Together, these behaviors cause legitimately earned incentives to disappear when positions are reduced or closed.
Root Cause
handle_action settles rewards from the post-mutation user_balance via min(balance_snapshot, user_balance) instead of the prior balance_snapshot, and the claim paths do not reliably advance indices before payout.
Impact
Users can permanently lose incentive emissions that accrued since their last successful reward settlement when they withdraw, repay, transfer interest-bearing tokens, or are liquidated. On a full exit, the entire unclaimed interval can be wiped out, and the broken claim flows described in the reports make it impractical for users to consistently avoid that loss by claiming first.
Proof of Concept
See this gist for full Proof of Concept
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
Likely the reward settlement uses the post-mutation balance via min(balance_snapshot, user_balance) instead of the prior balance_snapshot, and the claim paths do not reliably advance indices before payout.
Impact
Users can permanently lose incentive emissions that accrued since their last successful reward settlement when they withdraw, repay, transfer interest-bearing tokens, or are liquidated; on a full exit, the entire unclaimed interval can be wiped out.
What the attacker needed
A position earning incentives; a balance-reducing action such as withdrawal
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.
This is a smart contract that pays rewards for holding a balance over time. When you withdraw or repay, the contract should pay you for the time your money was there, but it looks at your balance after the withdrawal instead, which can be zero. So you lose the rewards you earned.
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.