# MU&MUG: flash-loan price manipulation drains bond contract

MU&MUG bond contract priced bonds off a manipulable MU/MUG AMM pair; attacker flash-swapped MU to skew price, minted bonds cheap, and drained $57k.

- Payout: Real-world hack
- Severity: high
- Program: - MU&MUG
- Analysis by: DeFiHackLabs
- Disclosed: 2022-12-10
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2022-12/MUMUG_exp.sol
- Library page: http://bugbountylibrary.com/r/dhl%3A20221210-mumug
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:chained vuln:flash-loan vuln:oracle-manipulation

**Target:** mu_bond/mu_gold_bond bond contract on Avalanche
**Root cause:** Bond minting priced MU/MUG via a spot AMM pair reserve ratio, which the attacker could move with a single large swap before calling mu_bond/mu_gold_bond.
**Steps:**
1. Flash-borrow nearly all MU from the MU/MUG pair via `Pair.swap(FlashLoanAmount, 0, address(this), new bytes(1))`.
2. In joeCall, swap MU to USDC.e to depress MU price on the pair.
3. Call `Bank.mu_bond(address(USDC_e), 3300 * 1e18)` and `Bank.mu_gold_bond(address(USDC_e), 6990 * 1e18)` at the skewed price.
4. Swap USDC.e back to MU via `USDC_eToMU()`.
5. Repay flash loan: `MU.transfer(address(Pair), FlashLoanAmount * 1000 / 997 + 1000)`.
6. Swap received MUG to USDC.e via MUG->MU->USDC.e path and keep profit.
**How found:** Recognized that mu_bond/mu_gold_bond read bond pricing from a low-liquidity AMM pair, making it flash-loan manipulable.
**Exploitation:** Single-transaction flash swap of the MU/MUG pair, manipulate MU spot price, mint bonds with USDC.e at the manipulated rate, unwind and repay, netting ~$57k in USDC.e.
**Insight:** Bond/stake contracts that price deposits from a spot DEX reserve ratio are flash-loan manipulable; check whether the mint rate reads Pair reserves directly rather than a TWAP or oracle.

