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

theOwl - Price reading from Uniswap pool can be manipulated #866

Closed
sherlock-admin opened this issue May 24, 2023 · 0 comments
Closed

theOwl - Price reading from Uniswap pool can be manipulated #866

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

theOwl

high

Price reading from Uniswap pool can be manipulated

Summary

USSDRebalancer is reading the price of the USSD/DAI pair directly from the pool, this price can be manipulated using flashloan for the attacker's profit.

Vulnerability Detail

USSDRebalancer calculate the price of USSD/DAI using the function getOwnValuation, first read the price directly from pool and here is where the problem is originating, as the contract reads the price directly from the pool and is not using the twap oracle, the price can be manipulated atomically using a flash loan to inflate the price of one asset.

Impact

The price that is read can be manipulated through the flash loan.

POC:

  1. Take flashLoan to inflate the pool price.
  2. Buy USSD for nothing ( a few DAI cents for millions of USSD )
  3. Call rebalance function where the USSD will try to rebalance the USSD/DAI pool
  4. Sell back the USSD at normal price + profit and pay the flash loan

Code Snippet

https://github.com/sherlock-audit/2023-05-USSD/blob/6d7a9fdfb1f1ed838632c25b6e1b01748d0bafda/ussd-contracts/contracts/USSDRebalancer.sol#L72
https://github.com/sherlock-audit/2023-05-USSD/blob/6d7a9fdfb1f1ed838632c25b6e1b01748d0bafda/ussd-contracts/contracts/USSDRebalancer.sol#L93

Tool used

Manual Review

Recommendation

Read the price using Uniswap TWAP instead of reading it directly from 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