Vulnerability Details
The GmxProxy
contract's afterOrderExecution
function directly accesses array elements of the eventData
parameter without performing bounds checking. Specifically, in the liquidation handling code path, the function attempts to access eventData.uintItems.items[0]
and eventData.addressItems.items[0]
without verifying if these arrays contain any elements.
This vulnerability is particularly concerning because the function is a critical callback that handles both regular order execution and liquidation events from the GMX protocol. The assumption that the event data arrays will always contain elements is unsafe, as external callbacks should be designed to handle any possible input state.
A coded function in the PerpetualVaultTest.sol
If a liquidation event is triggered with empty event data arrays, the liquidation process will fail due to the array out-of-bounds access, potentially leaving the system in an inconsistent state.
Since the function handles token transfers during liquidation, a revert at this stage could result in funds becoming temporarily or permanently stuck in the contract.
As this function is part of the core GMX integration logic, its failure could disrupt essential protocol operations, particularly during critical market events where liquidations are most likely to occur.
The vulnerability essentially makes the system susceptible to failure when handling certain valid GMX callback data structures, reducing the overall robustness and reliability of the protocol.
implement proper array bounds checking before accessing array elements
Consider adding input validation functions to verify the structure of eventData before processing.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
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.