# APEDAO: goDead() burn enables price manipulation drain

APEDAO token's goDead() burns pair-held tokens, inflating price; attacker used flash loans and skim to drain ~$7K.

- Payout: Real-world hack
- Severity: high
- Program: APEDAO
- Analysis by: DeFiHackLabs
- Disclosed: 2023-07-18
- Write-up quality: 7/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2023-07/ApeDAO_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20230718-apedao
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm vuln:business-logic vuln:flash-loan

**Target:** APEDAO token contract and PancakeSwap pair
**Root cause:** The goDead() function burns APEDAO tokens held by the PancakeSwap pair, drastically reducing supply and inflating the token price, which the attacker exploits to sell tokens at an inflated rate.
**Steps:**
1. Flash loan BUSDT from DPPOracle1, then chain flash loans from DPPOracle2, DPPAdvanced, DPPOracle3, and DPP.
2. Approve Router to spend BUSDT and swap 19,000 BUSDT for APEDAO via `swapExactTokensForTokens`.
3. Loop 16 times: transfer all APEDAO to the Pair contract and call `Pair.skim(address(this))` to recover excess tokens.
4. Call `APEDAO.goDead()` to burn APEDAO tokens held by the Pair, causing the token price to rise.
5. Transfer 1001 BUSDT to the Pair, then transfer all APEDAO to the Pair and call `Pair.swap(amounts[1], 0, address(this), bytes(""))` to swap APEDAO back to BUSDT at the inflated price.
6. Repay flash loans and keep the profit.
**Exploitation:** The attacker used flash loans to obtain BUSDT, bought APEDAO, repeatedly skimmed to concentrate APEDAO in the Pair, then called goDead() to burn the Pair's APEDAO and inflate the price. They then sold APEDAO back to the Pair for a large amount of BUSDT, repaid the flash loans, and profited ~$7K.
**Insight:** Look for token functions that burn or lock tokens held by liquidity pairs (e.g., goDead, burnFrom(pair)) as they can be used to manipulate price for profit via flash loans.

