Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

WATCHPUG - getOwnValuation() can easily be manipulated to trigger rebalance(). #814

Closed
sherlock-admin opened this issue May 24, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented May 24, 2023

WATCHPUG

high

getOwnValuation() can easily be manipulated to trigger rebalance().

Summary

The price of Uniswap v3 pool can be manipulated at low cost. USSDRebalancer relies on current price of USSD/DAI for rebalance triggering, which can be manipulated by attackers to force protocol to buy or sell collateral assets at specific time and conditions, making it economically profitable.

Vulnerability Detail

It is well-known that the price of an Uniswap v3 pool can be manipulated at a relatively low cost.

However, the USSDRebalancer relies solely on the current price of USSD/DAI for triggering the conditions of a rebalance, which will trigger a collateral sell and buyback or mint and collateral purchase.

An attacker could manipulate the price of USSD/DAI and force the protocol to buy or sell the collateral assets at the specific time and conditions they want.

When combined with the price manipulation of the collateral asset, this attack would be economically profitable.

PoC

  1. Manipulate the price of DAI/USD to 0.98 so that it triggers the sale of collateral, such as ETH.
  2. Manipulate the price of ETH/DAI to a lower value.
  3. Place a limit order like JIT liquidity at a lower price in the WETH/DAI pool to buy WETH.
  4. The BuyUSSDSellCollateral function is triggered, causing all ETH collateral to be sold at the manipulated price to DAI. The limit order placed at step 3 will be fulfilled.
  5. Reverse the prices.

Impact

Manipulating the price can trigger the protocol to buy/sell collateral assets. If the collateral asset is also manipulated, it would be sold at a manipulated price.

Code Snippet

https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/USSDRebalancer.sol#L71-L80

Tool used

Manual Review

Recommendation

Consider using TWAP rather than the current price of the pool.

Duplicate of #451

@github-actions github-actions bot closed this as completed Jun 5, 2023
@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jun 5, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant