CrvDepositorWrapper.sol relies on oracle that isn’t frequently updated
The CrvDepositorWrapper contract relies on a Balancer pool's TWAP oracle that is infrequently updated due to low trading volume, causing the oracle price to often not reflect true asset value. Combined with a 2% trading fee, this can lead to high slippage, failed transactions, or sandwich attacks when the distribute function is called.
Submitted by 0x52
CrvDepositorWrapper.sol#L56-L65
Unpredictable slippage, sandwich vulnerability or frequent failed transactions
Proof of Concept
CrvDepostiorWrapper uses the TWAP provided by the 20/80 WETH/BAL. The issue is that this pool has only handled ~15 transactions per day in the last 30 days, which means that the oracle frequently goes more than an hour without updating. Each time a state changing operation is called, the following code in the balancer pool takes a snapshot of the pool state BEFORE any operation changes it:
OracleWeightedPool.sol#L156-L161
This could result in the price of the oracle frequently not reflecting the true value of the assets due to infrequency of update. Now also consider that the pool has a trading fee of 2%. Combine an inaccurate oracle with a high fee pool and trades can exhibit high levels of “slippage”. To account for this outputBps in AuraStakingProxy needs to be set relatively low or risks frequent failed transactions when calling distribute due to slippage conditions not being met. The lower outputBps is set the more vulnerable distribute becomes to sandwich attacks.
Recommended Mitigation Steps
Consider using chainlink oracles for both BAL and ETH to a realtime estimate of the LP value. A chainlink LP oracle implementation can be found here.
0xMaharishi (Aura Finance) confirmed and commented:
Valid finding and agree with the severity generally. Vector here is either function reverting or potentially getting sandwiched.
To mitigate this currently, there is a
keeperaddress added and the tx would be sent via flashbots, however agree that other steps could be taken to allow it to operate more fluidly.
0xMaharishi (Aura Finance) resolved and commented:
Resolution for now is to use the CrvDepositorWrapper price as a guideline and let the
keeperof AuraStakingProxy provide a minOut.
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
The oracle used for pricing is based on a low-liquidity pool that updates infrequently, so its price can be stale and easily manipulated.
Impact
Trades could suffer high slippage, fail frequently, or be vulnerable to sandwich attacks, though the use of a keeper and flashbots may mitigate some risk.
What the attacker needed
Low-liquidity Balancer pool; 2% trading fee; keeper or user calls distribute
The fix
The project resolved to use the CrvDepositorWrapper price as a guideline and let the keeper provide a minOut, but the report recommends using Chainlink oracles for a real-time estimate.
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.
A smart contract uses a price from a trading pool to decide how many tokens to give out. But that pool is rarely traded, so its price is often out of date. An attacker could take advantage of the wrong price to profit, or normal users might get less than they should.