code-423n4 / 2023-07-tapioca-findings

12 stars 9 forks source link

TricryptoNativeStrategy `emergencyWithdraw` is prone to MEV sandwich attacked (bad slippage control) #291

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/05ba7108a83c66dada98bc5bc75cf18004f2a49b/contracts/curve/TricryptoNativeStrategy.sol#L188-L189

Vulnerability details

Impact

TricryptoNativeStrategy emergencyWithdraw is prone to MEV sandwich attacked -- the strategy can end up getting almost 0. This will leave depositors at a loss (drained all the deposited assets).

Proof of Concept

For the attacker to pull this attack off, the attack just needs to flashloan and become the majority of the underlying pool and make the pool imbalance (sandwiching the owner's emergencyWithdraw tx). The loss from the owner's liquidity removal will get shared to the LPs of the underlying pool, and since the large portion of the pool is owned by the attacker, the attacker can easily take that profit.

Tools Used

Manual Review

Recommended Mitigation Steps

Assessed type

MEV

c4-pre-sort commented 1 year ago

minhquanym marked the issue as duplicate of #245

c4-judge commented 1 year ago

dmvt marked the issue as duplicate of #158

c4-judge commented 1 year ago

dmvt changed the severity to 2 (Med Risk)

c4-judge commented 1 year ago

dmvt marked the issue as nullified

c4-judge commented 1 year ago

dmvt marked the issue as duplicate of #245