Open sherlock-admin opened 1 year ago
Escalate for 10 USDC
this should be medium because owner set conservative limit via ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR
and completly prevent this.
Escalate for 10 USDC
this should be medium because owner set conservative limit via
ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR
and completly prevent this.
You've created a valid escalation for 10 USDC!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
This issue is about being able to use the block.gaslimit, not anything having to do with the keeper gas estimation
Escalation rejected
This is a valid issue
Escalation rejected
This is a valid issue
This issue's escalations have been rejected!
Watsons who escalated this issue will have their escalation amount deducted from their next payout.
stopthecap
high
Creating an order of type MarketIncrease opens an attack vector where attacker can execute txs with stale prices by inputting a very extense swapPath
Summary
The vulnerability relies on the create order function:
https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/order/OrderUtils.sol#L69
Specifically, on a marketIncrease OrderType. Executing an order type of marketIncrease opens an attack path where you can execute transactions with stale prices.
Vulnerability Detail
The way to achieve this, is by creating a market increase order and passing a very extensive swapPath in params:
After calling marketIncrease close to gasLimit then using the callback contract that you passed as a param in:
https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/order/OrderUtils.sol#L114
an exceeding the block.gasLimit in the callback.
After "x" amount of blocks, change the gasUsage on the fallback, just that the transaction executes at the prior price.
PoC on how to execute the transaction with old pricing:
Impact
The attack would allow to make free trades in terms of risk. You can trade without any risk by conttroling when to execute the transaction
Code Snippet
https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/order/OrderUtils.sol#L50
Tool used
Manual Review
Recommendation
There need to be a way to cap the length of the path to control user input:
uint y = 10; require(swapPath.length < y ,"path too long");