The StabilityPool's reward distribution mechanism in conjunction with the RAACMinter's emission schedule allows attackers to deposit and withdraw funds within the same transaction while claiming disproportionately large RAAC token rewards. This occurs because newly minted rewards become immediately claimable regardless of staking duration, enabling economic exploitation through flashloan attacks.
RAACMinter's tick()
Function:
The tick()
function mints RAAC tokens to the StabilityPool based on blocks passed since the last update:
Even 1 block difference triggers minting - the only requirement to mint rewards is blocksSinceLastUpdate > 0
which is sufficed every time a user deposits or withdraws in any new transaction.
StabilityPool's Reward Calculation:. The calculateRaacRewards()
function distributes rewards proportionally based on current pool balance:
Deposit / Withdrawal always Triggers Minting:
When a user deposits via deposit()
, it calls _mintRAACRewards()
→ tick()
, minting new RAAC tokens to the pool based on blocks since last update.
Immediate Withdrawal Claims New Rewards:
If the attacker withdraws in the same transaction:
Newly minted RAAC tokens from the deposit are included in totalRewards
Attacker's share is calculated based on their transient deposit
Therefore attacker can deposit and withdraw in a single transaction and always get rewards. Also since the RTokens will be tradeable on many dexes, an attacker can chain a flashloan from a lending platform and thus swap to obtain large amount of RTokens which he can use to maximize the profit of the RAAC rewards.
The PoC below demonstrates how the attacker deposits and withdraws in the same transaction to get rewards but in the real world the attacker could weaponize use of flashloans to completely maximize the profits and cause inflation of the value of RAACToken.
Attackers can drain the RAAC token rewards from the StabilityPool with near-zero capital at risk (weaponizing FLASHLOAN to maximize profit). An attacker can do this in as much blocks as possible thus getting many RAAC rewards and causing the RAAC token to be inflated.
Unfair distribution of raac rewards for users who have staked their RTokens in the StabilityPool for a longer time, since the attacker gets a lot of rewards in a single tx while the rest of the users will get very little amounts.
Manual code analysis
Foundry test framework (provided PoC)
You can try any of the following methods;
Time-Weighted Reward Accrual:
Implement an accrual system tracking seconds-staked rather than instantaneous balances:
Locking Period Enforcement:
Require minimum deposit durations before allowing withdrawals to claim rewards.
Emission Timing Adjustment:
Modify RAACMinter to only mint rewards when sufficient time has passed:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.