DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing validation for `_callbackGasLimit` in GmxProxy::getExecutionGasLimit

Summary

The getExecutionGasLimit function in GmxProxy accepts an unconstrained _callbackGasLimit parameter without validating it against the GMX system's MAX_CALLBACK_GAS_LIMIT configuration, MAX_CALLBACK_GAS_LIMIT

Vulnerability Details

The getExecutionGasLimit function in GmxProxy does not enforce an upper bound on _callbackGasLimit. GMX’s keys.sol defines a MAX_CALLBACK_GAS_LIMIT, but it is not utilized in this function. This could allow excessively high callback gas limits, leading to unintended overestimations of execution fees.

GMX already defines a limit: Keys::MAX_CALLBACK_GAS_LIMIT

Impact

  • Overestimation of Execution Fee

  • Order execution reverts, due to wrong/overestimation of gas costs

Tools Used

Manua Review

Recommendations

Enforce a Cap on _callbackGasLimit

Modify getExecutionGasLimit to include a validation check:

function getExecutionGasLimit(
Order.OrderType orderType,
uint256 _callbackGasLimit
) public view returns (uint256 executionGasLimit) {
uint256 maxCallback = dataStore.getUint(MAX_CALLBACK_GAS_LIMIT);
require(
_callbackGasLimit <= maxCallback,
"Callback gas limit exceeds maximum"
);
// ... rest of the function
}
Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

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.

Suppositions

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!