Reproduced Exploit

GTE — swap drains pair via phantom amountIn from launchpad fees

1. Reserves exclude accrued launchpad fees; balances include them. 2. amountIn is inferred as balance - (reserve - amountOut). 3. Taking amountOut ≈ fee with no transfer credits a phantom amountIn. 4. K still holds (fee-inflated balances); attacker drains without paying.

Aug 2025Otheruntagged2 min read

Chain

Other

Category

untagged

Date

Aug 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. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 64852-h-04-attacker-can-drain-funds-from-gtelaunchpadv2pair-using. Standalone Foundry PoC and full write-up: 64852-h-04-attacker-can-drain-funds-from-gtelaunchpadv2pair-using_exp in the evm-hack-registry mirror.


Vulnerability classes: fee-calculation · direct-drain · fee-accounting

Reproduction: self-contained Foundry PoC with only forge-std. Full trace: output.txt. PoC: test/64852-h-04-attacker-can-drain-funds-from-gtelaunchpadv2pair-using_exp.sol.

AuditVault taxonomy: lang/solidity · platform/code4rena · has/github · has/poc · severity/high · sector/dex · sector/launchpad · genome: fee-calculation · direct-drain · fee-accounting


Key info#

ImpactHIGH — free token out up to ~accrued fees per swap; repeatable
ProtocolGTE
Vulnerable codeGTELaunchpadV2Pair.swap amountIn inference
Bug classBalance/reserve mismatch with fees
FindingCode4rena 2025-08 GTE · #64852 · H-04 · Nyxaris
ReportCode4rena report
SourceAuditVault
Compiler^0.8.24 (PoC)

TL;DR#

  1. Reserves exclude accrued launchpad fees; balances include them.
  2. amountIn is inferred as balance - (reserve - amountOut).
  3. Taking amountOut ≈ fee with no transfer credits a phantom amountIn.
  4. K still holds (fee-inflated balances); attacker drains without paying.

The vulnerable code#

SOLIDITY
uint256 amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; // @> VULN
uint256 amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; // @> VULN

Fix: subtract accrued launchpad fees when measuring amountIn and when checking K.


Root cause#

amountIn math treats fee inventory as if the attacker deposited it.


Preconditions#

  • Non-zero accrued launchpad fees; same-block so fees not distributed.

Attack walkthrough#

  1. Seed pair with reserves + fee0.
  2. Call swap(amount0Out ≈ fee0 * 997/1000, 0, attacker) with no input transfer.
  3. Pair credits phantom amount0In and pays out tokens.

Diagrams#

sequenceDiagram participant A as Attacker participant P as GTELaunchpadV2Pair A->>P: swap amountOut approx fee no input Note over P: amountIn inferred from fee balance P->>A: amountOut tokens drained

Impact#

Theft of pair inventory up to fee residual, repeatable same-block.


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.