Skip to content

Latest commit

 

History

History
41 lines (23 loc) · 1.43 KB

File metadata and controls

41 lines (23 loc) · 1.43 KB

Fast Khaki Raccoon

High

Users can sandwich the reward accrual of TokenRewards

Summary

Users can sandwich the reward accrual of TokenRewards

Root Cause

Depositing rewards in TokenRewards causes a stepwise jump in the reward per share which can be abused by users to avoid having to stake normally and simply take advantage of the accruals. There is no mechanism to defend against that, one such mechanism would be time like in the Synthetix staking protocol.

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

  1. Reward per share is 100 tokens
  2. Rewards will be deposited which results in the reward per share immediately going to 110
  3. A malicious user frontruns that, deposits 100 shares, his excluded rewards are now based on the 100 reward per share
  4. The reward deposit executes and reward per share goes to 110
  5. User immediately withdraws and gets a profit of 10 * 100 = 1000 tokens, completely risk-free

Impact

Risk-free profits for malicious users which are at the expense of honest stakers who will lose funds because of that.

PoC

No response

Mitigation

Implement some kind of a mechanism to guard against that, such as "vesting" the tokens over a period of time which is done in Synthetix. Alternatively, consider adding a delay between the deposit and withdrawal to make users at least have to stay staked for a certain period of time before withdrawing.