# 88MPH Theft Of Unclaimed MPH Rewards Bugfix Review

vesting03.createVestForDeposit failed to set vestRewardPerTokenPaid, letting a flash-loan depositor withdraw full unclaimed MPH rewards immediately and drain the vesting contract.

- Payout: $21,000
- Severity: high
- Program: 88mph
- Credited: 0xSzeth
- Disclosed: 2022-12-01
- Write-up quality: 8/10
- Original: https://immunefi.com/blog/bug-fix-reviews/88mph-theft-of-unclaimed-mph-rewards-bugfix-review/
- Library page: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-88mph-theft-of-unclaimed-mph-rewards-bugfix-review
- Tags: domain:web3 impact:funds-loss kind:bounty platform:blog platform:immunefi sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:business-logic vuln:flash-loan vuln:reward-distribution

**Target:** vesting03 smart contract (Solidity, EVM)
**Root cause:** createVestForDeposit() minted the vestID without initializing vestRewardPerTokenPaid[vestID] to the current rewardPerToken, so _earned() treated the full rewardPerToken as owed from the deposit amount.
**Steps:**
1. Flash-loan WETH from Uniswap V2 (or AAVE).
2. Call `DInterest.deposit(depositAmount, maturationTimestamp)` to mint deposit + vest ERC721.
3. Call `Vesting03.withdraw(vestID)` to claim MPH rewards immediately.
4. Call `DInterest.withdraw(depositID, depositAmount, true)` to pull the deposit back early.
5. Swap MPH to WETH via Balancer pool `0x3e09e828...02b1`.
6. Repay flash loan plus fee; size deposit via `amountToBeDeposited = withdrawAmount * PRECISION / rewardPerToken`.
**How found:** Whitehat read vesting03 and noticed createVestForDeposit did not update vestRewardPerTokenPaid[vestID] with current rewardPerToken, so an immediate deposit+withdraw would credit the full rewardPerToken; confirmed by on-chain txs from 0xe67d...7B18 that already exploited it.
**Exploitation:** Attacker flash-borrows WETH, deposits into DInterest to mint a vest NFT, immediately withdraws the vest to collect MPH rewards computed as if fully vested, then early-withdraws the deposit and swaps MPH for WETH on Balancer, repaying the loan. Deposit sized to drain most of vesting03's MPH balance (~3.66 ETH in the fork PoC).
**Insight:** In staking/vesting reward contracts, check that every mint of a new position initializes its reward-debt checkpoint (rewardPerTokenPaid) to the current accumulator; a missing init lets a fresh position claim the entire historical rewardPerToken, and flash loans make it free.
