A vulnerability exists in the GmxProxy contract where tx.gasprice is used to calculate execution fees. While most functions have appropriate access controls, this vulnerability can be exploited by users through the public withdraw()function in PerpetualVault, potentially draining ETH from the contract.
The attack path works as follows:
Users can call the public withdraw() function in PerpetualVault:
The _settle() function in PerpetualVault calls gmxProxy.settle():
The settle() function in GmxProxy uses tx.gasprice for fee calculation:
This chain of calls allows an ordinary user to indirectly trigger a function that uses tx.gasprice for calculating fees, which could be manipulated to drain ETH from the contract and send it to GMX.
A malicious user can exploit this vulnerability to:
Drain ETH from GmxProxy: By setting an extremely high tx.gasprice when calling withdraw(), the user can cause GmxProxy to send excessive amounts of ETH to the orderVault. This is particularly severe because there's no upper bound on the execution fee.
Manual code review
The most robust mitigation would be to implement a gas price oracle system that provides reliable gas price data for both Arbitrum and Avalanche networks, as the protocol will be deployed on both platforms.
If the sender does not provide enough, the transaction to create the order won't be included in the current block: no problem. If the user provides more, they will pay more: user mistake. Moreover, the `refundFee` is set to `true` only when the keeper is the caller, preventing manipulation.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.