GMX V1 Cross-Contract Reentrancy Exploit (July 9, 2025)
- Date
- 2025-07-09
- Loss
- $42M
- Category
- DeFi exploit (white-hat returned)
- Attack vector
- Cross-contract reentrancy via executeDecreaseOrder ETH refund, bypassing the ShortsTracker to manipulate global short average price and inflate GLP AUM
- Attribution
- Anonymous white-hat (funds returned for 10% bounty)
Overview
On July 9, 2025, the GMX V1 perpetuals exchange on Arbitrum was drained of approximately $42M through a cross-contract reentrancy that defeated a reentrancy guard the protocol had relied upon since 2021. The attacker exploited the fact that a nonReentrant modifier protects only the contract it sits on, not other contracts in the same system: when GMX's order-keeper executed a decrease order and refunded native ETH to a position owner, control passed to the attacker's contract during that refund, and the attacker reentered a different GMX contract (the Vault) to open and manipulate short positions before the system's accounting had settled. By repeatedly opening WBTC short positions without triggering an update to the global short average price and then closing them in a way that did update it, the attacker drove the recorded global short average price down by orders of magnitude, which inflated the protocol's assets-under-management calculation and therefore the price of the GLP liquidity-provider token. With GLP artificially overpriced, the attacker redeemed GLP for far more underlying value than it was worth, extracting roughly $42M from the pool. The vulnerability had been latent for years and, by several accounts, was reintroduced or left unguarded as part of a prior fix that went unaudited. GMX paused V1 trading and disabled GLP minting on Arbitrum and Avalanche, then opened an on-chain dialogue offering the attacker a 10% white-hat bounty in exchange for returning 90% of the funds. The attacker accepted: the bulk of the stolen assets were returned to the GMX multisig within roughly forty-eight hours, on July 11, 2025, with the attacker keeping approximately $4.2M-$5M. GMX subsequently finalized a compensation plan, reported at around $44M, to make affected GLP holders whole. The incident is the cleanest 2025 demonstration that cross-contract reentrancy can bypass single-contract guards, and that protocol-accounting variables such as a pool's AUM are high-value manipulation targets.
Timeline of events
On July 9, 2025, an attacker executed a sequence of transactions against GMX V1 on Arbitrum. The attacker first prepared by deploying a malicious contract and establishing positions, then triggered the reentrancy by routing through GMX's decrease-order execution flow, which refunds native ETH and in doing so handed control to the attacker's contract mid-execution. Over a series of manipulations the attacker distorted the protocol's global short average price for WBTC, inflating GLP's price, and then redeemed GLP to extract approximately $42M of underlying assets from the V1 pool. GMX's team detected the abnormal outflow and, within the same day, paused V1 leverage trading and disabled GLP minting on both Arbitrum and Avalanche to prevent further exploitation and to stop the manipulated GLP price from being used to mint or redeem further. GMX then posted an on-chain message to the attacker's wallet offering a standard white-hat arrangement: keep 10% as a bounty, return 90%, and face no further action. The attacker engaged, and over roughly the next forty-eight hours returned the bulk of the funds to GMX's multisig wallet, with the return substantially completed by July 11, 2025. CertiK, Halborn, BlockSec, SlowMist, and several audit firms published technical reconstructions in the days that followed, converging on the cross-contract reentrancy and the AUM-manipulation mechanism. GMX later finalized a compensation plan, reported by The Block at approximately $44M, to fully restore affected GLP holders.
Attack mechanism
The mechanism is documented in detail by BlockSec, CertiK, and Halborn. GMX V1's order-keeper contract calls executeDecreaseOrder to settle a user's request to reduce a position; as part of settlement, the function can refund native ETH, and that refund is delivered via an external call (internally, a transfer of ETH out). Because native-ETH transfers hand control to the recipient, an attacker who is the recipient can run arbitrary code at that moment. Crucially, GMX's reentrancy protection used a nonReentrant modifier on individual contracts, but a nonReentrant modifier guards only reentry into the same contract; it does not prevent the attacker, while holding control during the ETH refund, from calling into a different contract in the GMX system. The attacker reentered the Vault and called increasePosition to open short positions directly, in an ordering that bypassed the ShortsTracker, the component responsible for updating the global short average price. By opening WBTC short positions without the average-price update firing, and then closing positions in a way that did fire it, the attacker drove the stored global short average price for WBTC down dramatically (reconstructions cite the variable collapsing from roughly 1.08e35 to about 1.9e33 in the protocol's fixed-point representation, equivalent to crushing the recorded average short price from around $109,500 to a few thousand dollars). GMX computes GLP's price from the pool's assets under management, and AUM depends on the unrealized profit and loss of open positions, which depends on those average prices. By corrupting the short average price, the attacker inflated the apparent AUM and therefore the GLP price. Holding GLP that was now valued far above its true backing, the attacker redeemed it for underlying assets, extracting approximately $42M. The exploit is a textbook case of cross-contract reentrancy combined with manipulation of a protocol-accounting state variable.
Root cause analysis
There are two root causes. First is the reentrancy-guard scoping error: GMX V1 protected against same-contract reentrancy but not against an attacker who, holding control during an ETH refund in one contract, reenters a different contract in the same system. This is the cross-contract reentrancy pattern, and it defeats per-contract nonReentrant guards entirely. The fix is a system-wide reentrancy lock (a shared global lock) or strict adherence to checks-effects-interactions such that no externally-observable state is inconsistent at the moment control is handed to an external party. By several accounts the specific vulnerable path was introduced or left unguarded as part of a previous change that was not subjected to a full audit, which is why a guard the protocol had relied on since 2021 could be bypassed in 2025; the lesson that any change to a security-critical path requires re-audit recurs across the incident record. Second is the manipulability of protocol-accounting variables: GLP's price was derived from AUM, AUM from position PnL, and position PnL from average prices that the attacker could corrupt by controlling the order in which the ShortsTracker updated. Designs that derive a redeemable token's price from internal accounting variables must ensure those variables cannot be transiently manipulated within a single transaction, particularly under reentrancy. The deeper pattern is that GMX's on-chain code was, line by line, doing what it was written to do; the failure was a composition flaw across contracts and a manipulability flaw in the accounting model, not a single isolated bug.
Initial response and the white-hat return
GMX's response was rapid and, ultimately, successful in recovering nearly all of the loss. The team paused V1 leverage trading and disabled GLP minting on Arbitrum and Avalanche the same day, which both prevented further exploitation of the manipulated GLP price and removed the principal mechanism by which the attack could be repeated. GMX then took the increasingly common step of negotiating directly with the attacker on-chain, posting a message to the attacker's wallet offering a 10% bounty (approximately $4.2M-$5M) in exchange for the return of the remaining 90% and a commitment not to pursue the attacker. This white-hat framing, treating the exploiter as a bug-bounty participant rather than a criminal, has become a standard de-escalation tactic in DeFi precisely because it offers the attacker a clean, legal path to keep a meaningful sum while avoiding the laundering risk and law-enforcement exposure of attempting to keep the full amount. In this case the attacker accepted: the bulk of the stolen funds were returned to GMX's multisig wallet within roughly forty-eight hours, substantially completed by July 11, 2025, with the attacker retaining the bounty. The episode contrasts sharply with the DPRK exchange thefts, where funds are immediately laundered and never returned, and it illustrates that the response playbook differs fundamentally between profit-motivated independent exploiters (often returnable via bounty) and state-sponsored actors (never returnable).
Compensation and GLP holders
Because the loss came out of the GLP pool, the parties economically harmed were the GLP liquidity providers, whose token was redeemable for less underlying value after the extraction. The white-hat return recovered the large majority of the principal, but GMX moved to fully restore GLP holders rather than leave any residual shortfall. The Block reported that GMX finalized a compensation plan of approximately $44M to make affected GLP holders whole, funded from the returned assets together with protocol resources. The structure, recover the bulk via white-hat negotiation and backfill any remainder from the treasury so that liquidity providers experience no net loss, is the DeFi analogue of an exchange absorbing a hack from corporate treasury, and it preserved confidence in GLP as a yield-bearing liquidity instrument. GMX also signaled an accelerated migration emphasis toward V2, whose architecture differs from the exploited V1 design, and a security re-review of the V1 contracts that remained in operation. The clean outcome (near-total recovery plus full holder compensation) is one of the better resolutions in the 2025 incident record and stands in contrast to exploits where pool losses are socialized onto LPs with no backstop.
Funds tracking and attribution
Unlike the DPRK-attributed exchange thefts, the GMX exploit did not require extensive laundering analysis because the funds were returned. On-chain monitors tracked the attacker's contract deployments, the manipulation transactions, and the extraction, and then the return flow to GMX's multisig. The attacker's willingness to engage with GMX's on-chain bounty offer and to return 90% of the funds is itself strong evidence of an independent, profit-motivated actor rather than a state-sponsored group: DPRK-linked operators do not return funds, and the entire economic logic of a state theft program is incompatible with accepting a 10% bounty to return the rest. No public attribution to any named group has been made, and the prevailing characterization across the security firms that analyzed the incident is that of a sophisticated independent white-hat (or grey-hat) who exploited a genuine vulnerability and then chose the bounty path. This attribution profile matters for the threat model: it underscores that a large share of DeFi exploits are committed by independent actors for whom a credible, well-publicized white-hat bounty is a rational alternative to the legal and laundering risks of keeping the full sum.
Industry implications
The GMX exploit reinforced several lessons that the industry has been slow to fully internalize. First, cross-contract reentrancy is a real and exploitable class: per-contract nonReentrant guards are insufficient for multi-contract systems where control can be handed to an external party in one contract and used to reenter another, and protocols should adopt system-wide reentrancy locks or rigorous checks-effects-interactions discipline across contract boundaries. Second, any modification to a security-critical path must be re-audited; the GMX vulnerability persisted in part because a prior change to the affected path did not receive a full audit, echoing the Curve Vyper compiler-bug and Euler donation-path lessons that latent or reintroduced flaws in audited systems remain a leading cause of loss. Third, redeemable-token pricing derived from internal accounting (AUM-based GLP pricing) is a manipulation target, and designs must ensure such variables cannot be transiently corrupted within a single transaction. Fourth, the white-hat bounty model continues to prove its value: a fast pause plus a credible 10% bounty recovered roughly $42M, an outcome that no amount of post-hoc forensics could have achieved against a determined launderer. The contrast with the DPRK exchange thefts of 2025 is instructive, the response and recovery strategy must be matched to the attacker type, with bounty-and-negotiation viable against independent exploiters and freeze-and-trace the only available path against state actors.
Verdict and lessons
GMX is the cleanest 2025 case study in cross-contract reentrancy and protocol-accounting manipulation, and also one of the best-resolved incidents of the year. The V1 contracts behaved as written, the per-contract reentrancy guards did exactly what they were scoped to do, and yet $42M flowed out because control handed to an attacker during an ETH refund in one contract was used to reenter another and corrupt the average-price accounting that GLP's value depended on. The lessons are concrete. First, multi-contract systems require system-wide reentrancy protection, not per-contract guards; if an external call can occur anywhere in the system, an attacker can use it to reenter elsewhere. Second, every change to a security-critical path requires a full re-audit, because reintroduced or newly-unguarded flaws in otherwise-audited systems remain a leading loss cause. Third, any redeemable token whose price is derived from internal accounting must guarantee those accounting variables cannot be transiently manipulated within a transaction. Fourth, a fast pause combined with a credible, well-publicized white-hat bounty is the single most effective recovery tool against independent exploiters, and protocols should pre-establish the on-chain communication and bounty framework so it can be deployed within hours. The GMX outcome, near-total recovery plus full GLP-holder compensation, is what good incident response looks like when the attacker is profit-motivated rather than state-sponsored.
Recovery
The attacker accepted GMX's on-chain 10% white-hat bounty offer and returned ~90% of the ~$42M to the GMX multisig within roughly 48 hours, substantially completed July 11, 2025, keeping ~$4.2M-$5M. GMX paused V1 trading and disabled GLP minting on Arbitrum and Avalanche the same day, and finalized a compensation plan reported at ~$44M to make affected GLP holders whole.
Key lessons
- Multi-contract systems require system-wide reentrancy protection (a shared lock) or rigorous cross-boundary checks-effects-interactions; per-contract nonReentrant guards do not suffice
- Every change to a security-critical path must be fully re-audited; reintroduced or newly-unguarded flaws in audited systems remain a leading loss cause
- Redeemable tokens priced from internal accounting must guarantee those variables cannot be transiently manipulated within a single transaction
- A fast pause plus a credible, pre-arranged on-chain white-hat bounty is the most effective recovery tool against profit-motivated exploiters
- Match the response strategy to the attacker type: bounty-and-negotiate works against independents; freeze-and-trace is the only path against state actors
Frequently asked questions
What happened in the GMX V1 Cross-Contract Reentrancy Exploit?
GMX V1 on Arbitrum lost ~$42M on July 9, 2025 to cross-contract reentrancy: during an ETH refund in executeDecreaseOrder, the attacker reentered the Vault to open WBTC shorts in an ordering that bypassed the ShortsTracker, crushing the global short average price, inflating AUM and the GLP token price, then redeeming overpriced GLP. Per-contract nonReentrant guards did not stop reentry into a different contract; the vulnerable path reportedly came from a prior unaudited fix. GMX paused V1 and disabled GLP minting on Arbitrum and Avalanche, then offered an on-chain 10% white-hat bounty; the attacker returned ~90% within ~48 hours (by July 11), keeping ~$4.2M-$5M, and GMX finalized a ~$44M plan to make GLP holders whole. The cleanest 2025 case of cross-contract reentrancy plus accounting-variable manipulation, and a model white-hat resolution against a profit-motivated (non-state) exploiter.
How much was lost?
Approximately $42M was lost on 2025-07-09.
How did the attack work?
Cross-contract reentrancy via executeDecreaseOrder ETH refund, bypassing the ShortsTracker to manipulate global short average price and inflate GLP AUM
Who was responsible?
Anonymous white-hat (funds returned for 10% bounty)
Were the funds recovered?
The attacker accepted GMX's on-chain 10% white-hat bounty offer and returned ~90% of the ~$42M to the GMX multisig within roughly 48 hours, substantially completed July 11, 2025, keeping ~$4.2M-$5M. GMX paused V1 trading and disabled GLP minting on Arbitrum and Avalanche the same day, and finalized a compensation plan reported at ~$44M to make affected GLP holders whole.