# GDC: referral callback before floor burn drains pair

GDC sell calls onSellRewards paying referral EOAs before reserve-floor burn syncs; EIP-7702 delegated callbacks rewrote pair reserves, draining 51.2 WBNB.

- Payout: Real-world hack
- Severity: high
- Program: GDC
- Analysis by: DeFiHackLabs
- Disclosed: 2026-11-09
- Write-up quality: 9/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2026-11/GDC_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20261109-gdc
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:chained technique:race-window vuln:accounting-error vuln:business-logic vuln:flash-loan

**Target:** GDCToken/GDCMain sell path and Pancake V2 GDC/WBNB pair
**Root cause:** onSellRewards pays untrusted referral EOAs via raw call mid-transfer, before _applyReserveFloorDistribution syncs; delegated callbacks manipulate pair reserves so the floor burn removes gross sell and the unsynced 30% credit becomes excess against near-zero GDC reserve.
**Steps:**
1. Flash-borrow Moolah WBNB+BTCB, InstaFlash route 12 (Venus vWBNB/vBTC), and 5,000 WBNB flash swap from Pancake WBNB/USDT.
2. Supply BTCB to vBTC, borrow vBNB cash.
3. `swapTokensForExactTokens` buys pair down to exactly 21,000,000 GDC (LP_MIN_BALANCE), burning output.
4. Fund referral A with WBNB; its fallback pushes WBNB into pair and stores getAmountOut; referral B swaps quoted GDC out to 0xdead, dropping pair GDC side to just above gross sell.
5. `transferFrom` EOA's 41,047.699284897040065420 GDC into pair; callbacks fire inside transfer; floor burn pulls gross sell and syncs.
6. Swap the unsynced 30% excess for pair's WBNB; repay all loans in same tx.
**How found:** Parent-block trace of unverified token revealed _transfer order: 70% forward+sync, then onSellRewards raw call to referrals, then floor burn sync, then 30% credit without re-sync — the unsynced credit against manipulated reserves is the bug.
**Exploitation:** Attacker EOA bound to two EIP-7702-delegated referral EOAs (ReferralPush/ReferralSwap). During sell, onSellRewards raw-calls each upline; A pushes WBNB into pair, B swaps GDC out to 0xdead, collapsing GDC reserve. Floor burn then removes gross sell and syncs; 30% credit lands unsynced as excess, swapped out for pair WBNB. Flash loans (Moolah, InstaFlash route 12, Pancake WBNB/USDT) repaid same tx; net +50.008850 BNB.
**Escalation:** Chained three flash-loan sources plus EIP-7702 delegation to weaponize the referral callback and convert a 30% unsynced credit into full pair WBNB drain.
**Insight:** When a token's sell path pays external addresses via raw call before a reserve-floor sync, look for EIP-7702-delegated EOAs among referral slots: their fallback can rewrite pair reserves so the subsequent burn and unsynced credit become free WBNB.

## Proof of concept (copied exactly from the original report)

**Exploit contract setup and flash-loan interfaces**

```
contract GDCExploit {
    IWBNB internal constant WBNB = IWBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
    IERC20 internal constant BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);
    IGDC internal constant GDC = IGDC(0x39a90d082e19bD2AC30DA6964D3d2FDa50077777);
    IPair internal constant PAIR = IPair(0xe3349Ca6AC1656e02B20b8d5a4C095e28255eb0A);
    IRouter internal constant ROUTER = IRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
    IMoolah internal constant MOOLAH = IMoolah(0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C);
    IFLA internal constant FLA = IFLA(0xe620726686B480d955E63b9c7c1f93c2f8c1aCf4);
    IComptroller internal constant COMPTROLLER = IComptroller(0xfD36E2c2a6789Db23113685031d7F16329158384);
    IVToken internal constant VBTC = IVToken(0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7
```

