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

Reentrancy in afterOrderCancellation(), GmxProxy.sol

Summary

The afterOrderCancellation function lacks a reentrancy guard, making it potentially vulnerable to reentrancy attacks.

Vulnerability Details

The function makes an external call to IPerpetualVault(perpVault).afterOrderCancellation().

State update (delete queue;) happens after the external call.

An attacker could re-enter the function via perpVault before the state is updated, leading to unexpected behavior or state manipulation.

function afterOrderCancellation(
bytes32 key,
Order.Props memory order,
EventLogData memory /* eventData */
) external override validCallback(key, order) {
IGmxProxy.OrderResultData memory orderResultData = IGmxProxy
.OrderResultData(
order.numbers.orderType,
order.flags.isLong,
order.numbers.sizeDeltaUsd,
address(0),
0,
queue.isSettle
);
IPerpetualVault(perpVault).afterOrderCancellation(
key,
order.numbers.orderType,
orderResultData
);
// @ audit update the state after external call
delete queue;
}

Impact

Loss of funds (if state manipulation allows unauthorized actions).

Unexpected contract behavior due to inconsistent state.

Potential DoS attacks if the queue is not properly cleared.

Tools Used

Manual review

Recommendations

Update state variables first before making external calls, and use nonReentrant modifier.

Updates

Lead Judging Commences

n0kto Lead Judge 8 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.

n0kto Lead Judge 8 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.