Your DeFi Protocol’s Automation Layer is The Next Attack Target

Offchain DeFi automation: an underexamined risk exposing $129B in DeFi TVL
The July 2025 GMX exploit wasn’t just a $42M heist. It was an alarm bell — exposing a fragile, hidden layer of DeFi: offchain automation agents.
What GMX calls keepers are agents that liquidate loans, execute trades, rebalance pools, rotate validators, and shuttle assets across chains. They’re critical to protocol survival — yet operate with elevated permissions, little oversight, and growing appeal to attackers. If compromised, they can turn the protocol’s own infrastructure against it.
A case study: How GMX was exploited
GMX exploit wasn’t a sloppy wallet click or a user-facing bug. It was a surgical strike against GMX’s own automation:
- The Setup: Attacker deployed a malicious contract and submitted a “decrease position” order.
- The Trigger: GMX’s offchain keeper bot dutifully picked up the order.
- The Hijack: Mid-execution, the malicious contract reentered the vault before state updates were complete.
- The Manipulation: Pricing data was skewed, inflating GLP value.
- The Drain: Attacker minted and redeemed GLP at manipulated prices, siphoning $42M.
The vulnerability wasn’t driven by “bad code.” It was architectural. GMX transferred funds before completing state updates and failed to anticipate adversarial contract behavior.
Why this isn’t just a GMX problem
What GMX calls a “keeper,” other protocols call relayers, automation bots, or offchain agents. Whatever the label, they all share the same property: they hold the keys to write to a chain on the protocol’s behalf.
Keeper-style systems are essential infrastructure across DeFi:
- Aave: Uses keepers for liquidations
- Ether.fi: Uses keepers for staking operations
- Aevo: Uses keepers for order execution
- Badger, Aura, and dozens more all rely on similar automated systems
Across verticals, the risk of keepers manifests differently:
- DEXs: Execution bots or pool rebalancers can be manipulated to drain liquidity.
- Lending protocols: Compromised liquidation bots can cascade liquidations and destabilize collateral markets.
- Bridges: Relayers and validators form a single point of systemic risk for cross-chain settlement.
- Yield protocols: Auto-compounders or reward harvesters can be tricked into inflating balances or double-counting rewards.
- Staking/LSTs: Validator rotation and withdrawal automation creates new vectors for attack.
Over $129 billion in TVL depends on these systems working as intended. GMX is the first high-profile example that the automation layer can be turned against the protocols they serve.
Why the “keeper” vulnerability should keep you up at night
- Attackers are targeting infrastructure, not just contracts
- Keepers have elevated permissions with minimal oversight
- The economic stakes are enormous - your TVL is at risk
The solution: zero-trust transaction validation & anomaly monitoring
The key lesson from GMX: prevention is always faster than reaction. Instead of trying to recover funds after an exploit, DeFi admins should block malicious transactions before they can be executed.
Blockaid provides two layers of defense:
- Pre-transaction validation (Cosigner): simulate the complete transaction path independently of the signing process, detect unusual reentrancy patterns, and block execution by withholding the keeper’s signature.
- Asset monitoring: continuously observing onchain activity and contract interactions, detecting anomalies, price manipulation or other suspicious patterns and raising alerts before small issues escalate into stolen funds.
Three immediate actions to secure your DeFi protocol
- Map your automation surface area – catalog every bot, relayer, or off-chain agent that can write to a chain.
- Validate before execution – use transaction simulation, policy checks and validation to prevent malicious transactions from being released.
- Harden state management – assume every receiver is adversarial; explicitly guard against reentrancy and external call risks.
The future of DeFi security
The GMX exploit marks a turning point: attackers are shifting focus from user wallets and smart contracts to the unseen automation layers that keep protocols running.
The protocols that hardens their complete security posture - both onchain and offchain - will set the new security baseline for DeFi. Those who don’t risk becoming the next headline.
Blockaid is securing the biggest companies operating onchain
Get in touch to learn how Blockaid helps teams secure their infrastructure, operations, and users.