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.
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
Ada which is a malicious actor inspect pool to observe when the total RAAC reward is high
Call flashloan on Aave to borrow an arbitrary worth of crvUSDToken
Call deposit() on LendingPool contract with the borrowed crvUSDToken amount to receive rToken.
Call deposit() on stabilityPool contract with the rToken amount to receive deToken
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.
Call withdraw() on LendingPool contract with the retrieved rToken amount to receive crvUSDToken
Call Aave to repay the borrowed funds
Swap RAAC reward for other assets and make profits
Repeat action after a while
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.
Manual review
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.
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.