sherlock-audit / 2023-05-USSD-judging

9 stars 7 forks source link

simon135 - in `getOwnValution` we dont use a twap variable but instead use a not protected manipulates price #937

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

simon135

high

in getOwnValution we dont use a twap variable but instead use a not protected manipulates price

Summary

In getOwnValution we don't use a twap variable but instead use a not protected token amounts calculation an attacker can change the pool with flash loan causing different prices in the rebalance function It's not the actual price of the pool it's only the vulnerable price so we will be doing rebalancing for no reason if the attacker has a flash loan and secky the prices too low for USSD they can profit and the other way around is to and get dai at a lower price.

Vulnerability Detail

EX: Alice manipulates the pool by making USSD very cheap and getting then making it expensive and then Alice will sell the tokens for a profit.

Impact

Profit for the attacker, protocol can loss collateral because attacker can control when and how the protocol rebalances.

Code Snippet

  (uint160 sqrtPriceX96,,,,,,) =  uniPool.slot0();

Tool used

Manual Review

Recommendation

Use Twap price instead

Duplicate of #451