Closed sherlock-admin2 closed 10 months ago
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
The issue describes about DOSing setPool function by manipulating the Curve pool, but it's assumed that the Curve pool deployment, LP deposit, and setPool will be handled in one tx using multicall structure
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
The issue describes about DOSing setPool function by manipulating the Curve pool, but it's assumed that the Curve pool deployment, LP deposit, and setPool will be handled in one tx using multicall structure
bitsurfer
high
setPool
open for front-run issue (swap, add liquidity), resulting TWAP oracle failed to initializedSummary
setPool
open for front-run issue, making protocol unable to initialize the metapool thus TWAP oracle failed to initializedVulnerability Detail
Looking at following function in
LibTWAPOracle
, specifically on line 51,require(_reserve0 == _reserve1, "TWAPOracle: PAIR_UNBALANCED");
is open for a front-run attack, thus making owner unable to initialize the metapool for TWAP oracle usage.This exact comparison of balance between Dollar and 3CRV LP definitely will raise issues.
Someone can front-run the
setPool
, and manipulate these balances, resulting revert on it.There are several cases to manipulate these balance, for example, swapping one token of 3pool (DAI-USDC-USDT) to Dollar (UbiquityDollar) which is
_reserve0
, or increase the_reserve1
balance by minting LP via adding liquidity or deposit 3pool (DAI-USDC-USDT)This means, when Ubiquity protocol deploy the metapool in Curve, initialize, then before calling
setPool
, it's possible to front-run the transaction.The front-run could change the balance of either reserve0 or reserve1, thus revert will raise and TWAP oracle will not be initialized correctly.
Impact
Unable to register or call
setPool
, thus TWAP oracle failed to initialized.Since TWAP oracle is not initialized, the
LibTWAPOracle.update();
which is crucial inmintDollar
andredeemDollar
it will break this functionality, thus this can be considered as high issue.Code Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibTWAPOracle.sol#L51
Tool used
Manual Review
Recommendation
Consider to remove the
require(_reserve0 == _reserve1, "TWAPOracle: PAIR_UNBALANCED");
and give the relative adjustment to the price average based on current balance.Duplicate of #14