`EmptyFeedPrice` will cause orders to be canceled
Source: https://github.com/sherlock-audit/2023-02-gmx-judging/issues/175
Found by
IllIllI
Summary
In most cases where orders are submitted using invalid oracle prices, the check for isEmptyPriceError() returns true, and the order execution is allowed to revert, rather than canceling the order.
Vulnerability Detail
EmptyFeedPrice isn't counted as one of these errors, and so if the price reaches zero, any outstanding order will be canceled.
Impact
Orders to close positions will be canceled, leading to losses.
Code Snippet
Only isEmptyPriceError() errors are allowed to revert:
// File: gmx-synthetics/contracts/exchange/OrderHandler.sol : OrderHandler._handleOrderError() #1
226 if (
227 @> OracleUtils.isEmptyPriceError(errorSelector) ||
228 errorSelector == InvalidKeeperForFrozenOrder.selector
229 ) {
230 ErrorUtils.revertWithCustomError(reasonBytes);
231 }
232
233 Order.Props memory order = OrderStoreUtils.get(dataStore, key);
234 bool isMarketOrder = BaseOrderUtils.isMarketOrder(order.orderType());
235
236 if (isMarketOrder) {
237: OrderUtils.cancelOrder(
Other orders get frozen or canceled
Tool used
Manual Review
Recommendation
Include EmptyFeedPrice in the list of OracleUtils.isEmptyPriceError() errors
Discussion
xvi10
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in GMX Update. Sherlock made it public on 4 April 2023. Found in the 6 audit contest (finding M-7).
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.