Users That Deposit Into Ichi Spell Can be Unfairly Liquidated by Attacker
Summary
Ichi Spell does not use a Chainlink or TWAP oracle for liquidity positons, but rather the token price in the Uniswap v3 Pool. An attacker can liquidate other users with flashloans and/or swaps on the Uniswap v3 pool and obtain their tokens at a discount.
Vulnerability Detail
Liquidations for Ichi Liquidity positions are calculated via theget Price() function in IchiOracle. However unlike the other Liquidation Oracles which are designed to be liquidation resistant, eg. depending on Chainlink Oracles, this depends on the price of Uniswap.
A TWAP oracle should be used to calculate the value of Uniswap liquidity positions, or liquidations should not happen if the Uniswap price significantly differs from the price of external price oracles.
banditx0x
high
Users That Deposit Into Ichi Spell Can be Unfairly Liquidated by Attacker
Summary
Ichi Spell does not use a Chainlink or TWAP oracle for liquidity positons, but rather the token price in the Uniswap v3 Pool. An attacker can liquidate other users with flashloans and/or swaps on the Uniswap v3 pool and obtain their tokens at a discount.
Vulnerability Detail
Liquidations for Ichi Liquidity positions are calculated via the
get Price()
function in IchiOracle. However unlike the other Liquidation Oracles which are designed to be liquidation resistant, eg. depending on Chainlink Oracles, this depends on the price of Uniswap.It is not a Uniswap TWAP but the Uniswap price at a particular block, which makes price manipulation trivial.
Heres how the attacker can create an unfair liquidation:
Impact
Liquidity Providers on Blueberry Ichi Spell can be unfairly liquidated by attackers, with the attacker profiting from this transaction.
Code Snippet
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/oracle/IchiLpOracle.sol#L19-L40
Tool used
Manual Review
Recommendation
A TWAP oracle should be used to calculate the value of Uniswap liquidity positions, or liquidations should not happen if the Uniswap price significantly differs from the price of external price oracles.
Duplicate of #20