# AIXBTForcedSwap: hardcoded auth key forces victim swap

AIXBT victim contract had a hardcoded keccak256 auth key in bytecode, letting attacker force it to swap its USDC/WETH into attacker-seeded pools for 13,597 USDC.

- Payout: Real-world hack
- Severity: high
- Program: AIXBTForcedSwap
- Credited: DeFiHackLabs
- Disclosed: 2025-01-26
- Write-up quality: 7/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2025-01/AIXBTForcedSwap_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20250126-aixbtforcedswap
- Tags: domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:reverse-engineering technique:source-review vuln:access-control vuln:auth-bypass vuln:business-logic

**Target:** On-chain victim contract on Base with swap selector 0x229e9756
**Root cause:** Victim contract's swap function authenticates callers with a hardcoded bytecode constant keccak256("1205060227") instead of a real access control, so anyone can invoke it. It then approves its own token balance to the Uniswap router and executes caller-controlled exactInputSingle params.
**Steps:**
1. Flash-borrow 10 AIXBT from AIXBT/USDC Uniswap V3 pool `0xf1Fdc83c...`
2. In callback, createAndInitializePoolIfNecessary for AIXBT/USDC and WETH/AIXBT at 0.01% fee, sqrtPriceX96 = 1<<96
3. Mint one-sided AIXBT liquidity in AIXBT/USDC pool
4. Call victim `0x32cD8541...` selector `0x229e9756` with auth key `keccak256("1205060227")` and exactInputSingle params routing victim's full USDC balance into attacker pool
5. Remove liquidity and collect USDC
6. Repeat with WETH/AIXBT pool to drain victim's WETH
7. Swap collected WETH to USDC, top up AIXBT owed, repay flash loan, forward USDC profit
**How found:** Decompiled the unverified victim contract and spotted the selector 0x229e9756 checking `key == keccak256("1205060227")` as a public bytecode constant, revealing an auth bypass usable by any caller.
**Exploitation:** Attacker flash-borrows AIXBT, seeds narrow one-sided Uniswap V3 pools at manipulated 1:1 price, then calls the victim's unverified selector 0x229e9756 passing the hardcoded keccak256("1205060227") key. The victim approves its own tokenIn balance to the router and swaps its entire USDC then WETH balance into attacker pools at attacker-controlled prices. Attacker removes LP, repays flash loan, keeps 13,597.36 USDC.
**Escalation:** Chained flash loan + pool creation + forced victim swap to extract both USDC and WETH balances in one transaction.
**Insight:** When a target contract is unverified, decompile it and grep for keccak256 constants compared against calldata — hardcoded 'secrets' in bytecode are readable by anyone and often gate privileged swap/approve logic.
