Reproduced Exploit

GlueX V2: partner share consumes the whole surplus and the protocol is paid 0

swap subtracts the partner's surplus share and the partner's slippage share from the surplus, and protocolSlippageShare has no minimum. With a 50% partner surplus share, a 25% partner slippage share, and a 0 protocol slippage share, a 100 OUT surplus is paid entirely to the partner. The treasury tr…

Jun 2025•Other•logic•3 min read

Loss

100 OUT of surplus paid to the partner; protocol treasury receives 0

Chain

Other

Category

logic

Date

Jun 2025

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 61337-h-01-protocol-can-receive-zero-shares-despite-surplus-shield. Standalone Foundry PoC and full write-up: 61337-h-01-protocol-can-receive-zero-shares-despite-surplus-shield_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/fee-calculation · vuln/logic/missing-check

Key info#

FieldValue
Loss100 OUT of surplus paid to the partner; protocol treasury receives 0
Vulnerable contractGluexRouter.swap
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateLocal synthetic · 2025-06
Compilersolc 0.8.27, cancun, via IR
Bug classPartner surplus share plus partner slippage share can zero the protocol share

TL;DR#

swap subtracts the partner's surplus share and the partner's slippage share from the surplus, and protocolSlippageShare has no minimum. With a 50% partner surplus share, a 25% partner slippage share, and a 0 protocol slippage share, a 100 OUT surplus is paid entirely to the partner. The treasury transfer is 0.

The vulnerable code#

SOLIDITY
uint256 partnerSurplus = (surplus * partnerSurplusShare) / 10000;
uint256 partnerSlippage = (slippage * partnerSlippageShare) / 10000;
uint256 partnerShare = partnerSurplus + partnerSlippage;
uint256 protocolSurplus = surplus - partnerShare;
uint256 protocolSlippage = (slippage * protocolSlippageShare) / 10000;
protocolShare = protocolSurplus + protocolSlippage;

The audited router has the same subtraction. A minimum on protocolSlippageShare is what stops a configured partner from taking the whole surplus.

Root cause#

The protocol share is a remainder. Nothing requires that remainder to be positive, and the protocol's own slippage share can be zero.

Preconditions#

  • A swap produces 100 OUT of surplus.
  • Partner surplus share is 50 and partner slippage share is 25. Protocol slippage share is 0.

Attack walkthrough#

  1. The router records a 100 OUT surplus.
  2. Partner share is computed as the whole 100.
  3. Protocol share is 0.
  4. The partner is transferred 100 OUT. The treasury balance stays 0.

Diagrams#

flowchart TD A["Swap surplus is 100 OUT"] --> B["Partner surplus share is 50 percent"] B --> C["Partner slippage share takes the rest"] C --> D["Protocol slippage share is 0"] D --> E["Treasury transfer is 0 and the partner keeps 100 OUT"]

Impact#

The protocol earns nothing on a swap that generated a real surplus. This run pays the entire 100 OUT to the partner.

How to reproduce#

BASH
cd 61337-h-01-protocol-can-receive-zero-shares-despite-surplus-shield_exp
forge test -vv

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.