# PrismaFi MigrateTroveZap insufficient validation drains $11M

PrismaFi MigrateTroveZap lacked validation on flash-loan callback data, letting attacker open/close troves with borrowed mkUSD and drain ~$11M in wstETH.

- Payout: Real-world hack
- Severity: critical
- Program: PrismaFi
- Analysis by: DeFiHackLabs
- Disclosed: 2024-03-29
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2024-03/Prisma_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20240329-prisma
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:critical tech:evm tech:solidity technique:chained vuln:access-control vuln:business-logic vuln:flash-loan

**Target:** MigrateTroveZap / BorrowerOperations (Liquity-style CDP)
**Root cause:** MigrateTroveZap's flash-loan callback trusted caller-supplied calldata (account, trove managers, coll, fee) without validating that the callback originated from the mkUSD flashLoan and that parameters matched the loan, allowing arbitrary trove operations.
**Steps:**
1. Flash-borrow ~1.44M mkUSD from mkUSD token, passing MigrateTroveZap as receiver with crafted `data` (account, troveManagerFrom/To, maxFee, coll, hints).
2. MigrateTroveZap callback executes trove migration using attacker-controlled params, opening a trove on attacker's behalf.
3. Flash-borrow 1 wstETH from Balancer vault.
4. In `receiveFlashLoan`: approve BorrowerOperations for max wstETH, call `setDelegateApproval(MigrateTroveZap, true)`.
5. Call `openTrove(TroveManager, this, maxFee, 1e18 wstETH, 2000e18 mkUSD, hints)` to mint mkUSD against the borrowed wstETH.
6. Flash-borrow another 2000e18 mkUSD via MigrateTroveZap with crafted data (coll 1282.79 wstETH).
7. Call `closeTrove(TroveManager, this)` to withdraw the wstETH collateral.
8. Repay 1 wstETH to Balancer; retain ~1281.79 wstETH profit.
**Exploitation:** Attacker used mkUSD flash loans routed through MigrateTroveZap with attacker-controlled callback data to manipulate trove open/close operations, combined with a Balancer wstETH flash loan as collateral, minting mkUSD and closing the trove to extract wstETH collateral.
**Escalation:** Chained mkUSD flash loan + Balancer wstETH flash loan + delegate approval to amplify collateral and drain protocol wstETH.
**Insight:** Flash-loan receiver contracts that accept arbitrary calldata (account, manager addresses, amounts) without verifying msg.sender is the lending token and that params match the loan are prime targets; check Liquity-fork migration/zap helpers for unvalidated callback params.
