Rewards distribution can be delayed/never distributed on AuraLocker.sol#L848
An attacker can send a tiny amount of a reward token to the staking proxy and then call the distribution function, which resets the reward period and dilutes the reward rate. This can be repeated to delay or prevent rewards from being distributed.
Submitted by 0xjuicer, also found by csanuragjain
Rewards distribution can be delayed/never distributed on AuraLocker.sol#L848
Issue
Someone malicious can delay the rewards distribution for non cvxCrv tokens distributed on AuraLocker.sol.
1: Attacker will send one wei of token that are distributed on the AuraLocker.sol to AuraStakingProxy.
2: Attacker will call distributeOther. The function will call notifyRewardAmount that calls _notifyReward
When calling _notifyReward the rewards left to distribute over the 7 days are redistributed throughout a new period starting immediately.
uint256 remaining = uint256(rdata.periodFinish).sub(block.timestamp);
uint256 leftover = remaining.mul(rdata.rewardRate);
rdata.rewardRate = _reward.add(leftover).div(rewardsDuration).to96();
Example: If the reward rate is 1 token (10**18) per second and 3.5 days are left (302400 seconds), we get a leftover of 302400 tokens. this is then divided by 604800, the reward rate is now 0.5 and the user of the protocol will have to wait one week for tokens that were supposed to be distributed over 3.5 days. This can be repeated again and again so that some rewards are never distributed.
Recommended Mitigation Steps
I can see that queueNewRewards has some protective mechanism. A new period is started only if the token that is added on top of the already distributed tokens during the duration is over 120%.
I suggest adding a similar check to queueNewRewards
0xMaharishi (Aura Finance) confirmed, but disagreed with severity
0xMaharishi (Aura Finance) resolved:
code4rena aurafinance/aura-contracts#84 code-423n4/2022-05-aura#6
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 notification logic always restarts the reward period and recalculates the rate when any new reward is added, without a minimum threshold or protection against tiny additions.
Impact
Rewards distribution for non-cvxCrv tokens can be delayed or never fully distributed, as the attacker can repeatedly reset the reward period.
What the attacker needed
Attacker can send tokens to the proxy; attacker can call distributeOther
The fix
A similar protective check to the one in queueNewRewards should be added to the reward notification logic, so a new period only starts if the added reward is over 120% of the remaining distribution.
How it was found
- Send a very small amount of a reward token to the staking proxy contract.
- Call the distributeOther function on the staking proxy.
- The call triggers notifyRewardAmount and then _notifyReward, which recalculates the reward rate and restarts the period.
- Repeat the process to keep delaying distribution.
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.
Rewards are paid out over a fixed period. If someone adds even a tiny amount of new reward, the contract recalculates the payout rate and restarts the period. An attacker can do this repeatedly so that the original rewards are spread thinner and take much longer to arrive, or never fully arrive.
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.