Blog / gmx-v1-reentrancy-2025

GMX V1 Reentrancy Exploit: How a Classic Bug Drained $42M

A detailed breakdown of the July 2025 GMX V1 hack—how a well-known smart contract vulnerability enabled huge losses, and the updated norms for DeFi security audits.

Author0xTeam AuthorJuly 12, 2025
GMX V1 Reentrancy Exploit: How a Classic Bug Drained $42M

GMX V1 Reentrancy Exploit: New Code, Old Vulnerabilities

Exposing the Reentrancy Sequence

In July 2025, GMX Version 1—the original perpetual DEX—was hit for $42 million by an attacker who leveraged a reentrancy bug in the executeDecreaseOrder() function. This function was meant to process user withdrawals but, due to an upgrade in state-handling logic, allowed a malicious contract to call back into GMX before critical accounting variables (notably the global average short price) were updated. This reentrancy flaw let the attacker manipulate key protocol invariants, moving global price metrics out of sync and claiming artificially profitable redemptions.

The reentrancy was specifically introduced by a previous hotfix in late 2024, which sought to patch a race condition in global position tracking for shorts. The new logic, however, called user contracts before updating key protocol state, which broke the atomicity and opened a reentrancy window. The attacker created a custom contract that recursively triggered executeDecreaseOrder() during the refund process. Each pass left price metrics increasingly inaccurate. By the end, the exploit let them drain $42M, mostly via GLP redemptions at inflated asset-under-management rates. Fortunately, after negotiation, the attacker returned most of the funds in exchange for a $5M whitehat bounty.

Code Legacy and New Audit Culture

The GMX incident reinforced that even “solved” bugs like reentrancy can reappear any time protocol logic is hastily changed—especially in response to urgent issues. GMX’s vulnerability arose not from original design, but from an upgrade implemented post-bug bounty. The incident highlighted the need for exhaustive, post-patch security reviews and regression tests on all upgraded contract paths.

After the exploit, GMX replaced all external call logic with push-only internal accounting, enforced complete state updates before user callbacks, and mandated a third-party audit on every codebase change. Formal verification is now required after material upgrades, not just initial deployments. For the broader DeFi sector, the GMX hack echoes a familiar message: every fix creates a new attack surface unless change management gets the same scrutiny as launches. Reentrancy risks aren’t historical—they’re perpetual if composability isn’t managed by design and tested at every turn.

Decorative Background

Worried?, Get your security audit done today!

Request Audit

// ECOSYSTEM \\

What Next? Lets Chat!

Don't leave your blockchain assets vulnerable. Our top quality security experts are standing by to help you identify and address potential threats.

Decorative

0xTeam in the Spotlight!

news

𝗣𝗼𝗹𝘆𝗴𝗼𝗻 𝗲𝗰𝗼𝘀𝘆𝘀𝘁𝗲𝗺! 0xTeam is here to secure the future of Web3—one audit at a time.

news

Big news! 🚀 0xTeam is now 𝗽𝗮𝗿𝘁𝗻𝗲𝗿𝗲𝗱 𝘄𝗶𝘁𝗵 getWalletX to strengthen Web3 security. 🔐

news

𝗕𝗶𝗴 𝗻𝗲𝘄𝘀 — 𝟬𝘅𝗧𝗲𝗮𝗺 𝘅 𝗔𝗹𝗰𝗵𝗲𝗺𝘆 🤝 : Pumped to be collaborating in the same ecosystem ...

news

Crossmint : Expert Web3 security professionals providing top-notch web3 security solutions .....

news

Playartsdotai X 0xTeam : Boosting Security to New Heights!