Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Valid

Malicious actor can game the sytem to gain higher percentage of reward token through flashloan

Summary

The stability pool which allow liquidity providers to deposit and withdraw rToken together with their respective RAAC reward is vulnerable to flashloan exploit which can be use to gain higher percentage of reward in the system.

Vulnerability Details

In the stability pool contract, a malicious liquidity provider or user can exploit the logic of the reward system to gain higher advantage of share through the use of flash loan.

As seen in the function deposit(), whenever a user provide liquidity to the system through the method, it firstly calls on _update() which triggers the reward minting process and updates the emmission rate if the interval has passed. As a means of economic incentives, LPs are encouraged and rewarded with RAAC token. This RAAC token are been calculated and transferred together with their rToken when a LP calls the function withdraw() with an appropriate deCRVUSDAmount. The amount of RAAC token reward to be distributed to individual LP is proportional to the amount of rToken deposited. This implies the higher the deposit the higher the percentage of RAAC reward.

Now a malicious user can simply exploit this logic by monitoring the pool system to observe when the total RAAC token reward is high, use flashloan to borrow an enormous amount of crvUSD from AAVE(or any flashloan provider). Call deposit() into this pool with the amount and immediately call withdraw() on the same block. This way the attacker can continuously game the system to mint higher percentage of reward to themselves.

POC

  1. Ada which is a malicious actor inspect pool to observe when the total RAAC reward is high

  2. Call flashloan on Aave to borrow an arbitrary worth of crvUSDToken

  3. Call deposit() on LendingPool contract with the borrowed crvUSDToken amount to receive rToken.

  4. Call deposit() on stabilityPool contract with the rToken amount to receive deToken

  5. Call withdraw() on stabilityPool contract with the deToken amount to retrieve her rToken and unfair amount of RAAC reward due to the high deposit amount.

  6. Call withdraw() on LendingPool contract with the retrieved rToken amount to receive crvUSDToken

  7. Call Aave to repay the borrowed funds

  8. Swap RAAC reward for other assets and make profits

  9. Repeat action after a while

Impact

This vulnerability will impact the protocol negatively as genuine liquidity providers will constantly be rewarded with dust amount while the malicious actor steals higher pot of the reward share from providing little to no value to the system.

Tools Used

Manual review

Recommendations

Implement a time-based constraints mechanism on this contract operation to prevent rapid or simultaneous execution of multiple transactions within a single block. This can help mitigate the impact of flash loan attacks on the system.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

StabilityPool::calculateRaacRewards is vulnerable to just in time deposits

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!