# Discover ETHpledge: flash-loan oracle manipulation mints cheap Discover

Discover's ETHpledge priced Discover off its own USDT balance, so a flash-loan-drained pool let the attacker mint 62,536 Discover for 2,000 USDT and net ~16,336 USDT.

- Payout: Real-world hack
- Severity: high
- Program: Discover
- Analysis by: DeFiHackLabs
- Disclosed: 2022-06-06
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2022-06/Discover_exp.sol
- Library page: http://bugbountylibrary.com/r/dhl%3A20220606-discover
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity vuln:business-logic vuln:flash-loan vuln:oracle-manipulation

**Target:** BSC staking/pledge contract (ETHpledge) with on-chain price oracle
**Root cause:** ETHpledge.getprice derives the Discover swap price from usdt.balanceOf of the contract/pool; draining that balance via flash loan lowers _price/_swapprice and inflates the curTamount of Discover paid out per USDT deposited.
**Steps:**
1. Flash-borrow ~2,100 USDT and ~19,810 USDT from PancakeSwap pairs (BSC-USD-Discover pair 0x92f961B6bb19D35eedc1e174693aAbA85Ad2425d).
2. Call `ETHpledge.pledgein(0xAb21300fA507Ab30D50c3A5D1Cad617c19E83930, 2000000000000000000000)` depositing 2,000 USDT while the pool's USDT balance is depressed.
3. getprice reads the reduced usdt.balanceOf, lowering _price/_swapprice and raising curTamount, so ETHpledge.team sends 62,536 Discover to the attacker address.
4. Repay 19,810 USDT to the BSC-USD-Discover pair.
5. Swap 62,536 Discover back for ~16,336 USDT, repay the 2,100 USDT flash loan, convert profit to BNB.
**How found:** Analysis observed that pledgein's payout depends on getprice, which reads the live usdt.balanceOf; since that balance is externally controllable via flash loans, the price can be pushed down before depositing.
**Exploitation:** Attacker contract flash-swapped BUSD from PancakeSwap pairs, deposited a small 2,000 USDT into ETHpledge while the manipulated balance made the oracle price Discover cheaply, received 62,536 Discover, repaid the flash swap, sold Discover for ~16,336 USDT, repaid the second loan and cashed out ~49 BNB to Tornado.Cash.
**Insight:** When a staking/mint contract computes exchange rate from its own token balance (balanceOf-based oracle), check whether an attacker can move that balance within one transaction via flash swap before calling the deposit/mint function.

