Closed c4-bot-8 closed 6 months ago
Seem like a design decision.
0xRobocop marked the issue as insufficient quality report
0xRobocop marked the issue as primary issue
By design, the issue states that a mechanism intended to prevent withdrawals when the price differs too much prevents withdrawals when the price differs too much.
OpenCoreCH marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-02-hydradx/blob/main/HydraDX-node/pallets/omnipool/src/lib.rs#L745-L753
Vulnerability details
Bug Description
The HydraDX protocol implemented multiple safeguards against users manipulating the price of LRNA, as a result of the Critical-2304 found in the protocol. One of those safeguards is that in case of a token price deviating from the EMA oracle by more than 1% within a block, withdrawals of this token are halted.
The EMA oracle calculates an exponential moving average of the past prices in Stableswap / Omnipool. Unfortunately, this fix results in a new issue if the price of a token falls really fast, at a faster rate than 1% per block. In that case, the liquidity of this token will not be withdrawable until the price has started to bottom out. The users that have deposited liquidity of the falling token are forced to endure the full impermanent loss.
Impact
This issue results in liquidity providers being forced to endure the impermanent loss of a token in the pool.
Proof of Concept
The following testcase showcases the functionality
Tools Used
Manual Review
Recommended Mitigation Steps
The issue can be mitigated by implementing a different functionality for preventing price manipulations. An example could be to include an external oracle like Chainlink. If the price from Chainlink is also falling very quickly, users should be able to withdraw their liquidity to not be forced to endure impermanent loss.
Assessed type
DoS