# Virtual borrow shares accrue interest and lead to bad debt

Morpho Blue's unowned virtual borrow shares accrue compounding interest, creating unrepayable bad debt that reduces withdrawable supply; share price can be inflated to amplify it.

- Payout: Contest reward
- Severity: medium
- Program: Morpho Blue
- Credited: Christoph Michel
- Disclosed: 2024-09-28
- Write-up quality: 7/10
- Original: https://cdn.cantina.xyz/reports/cantina_competition_morpho_blue_dec2023.pdf#3.2.4
- Library page: https://bugbountylibrary.com/r/cantina%3Amorpho_blue_dec2023%3A3.2.4
- Tags: domain:web3 impact:funds-loss kind:contest platform:cantina sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:precision-loss

**Target:** Morpho.sol lending market accounting (_accrueInterest, borrow shares)
**Root cause:** Virtual borrow shares (1e6 offset) not owned by anyone earn interest in _accrueInterest; since withdrawable = supplyAssets - borrowAssets, their accrued assets become unrepayable bad debt.
**Steps:**
1. Deploy market with collateral token and oracle; supply collateral of 1e6 ether and set price 1 ether.
2. Borrower supplies collateral and borrows 1e4 assets, creating virtual borrow shares.
3. Loop 100 times: read expectedMarketBalances, compute shares = (totalBorrowShares + 1e6).mulDivUp(1, totalBorrowAssets + 1) - 1, call `morpho.borrow(marketParams, 0, shares, BORROWER, RECEIVER)` to inflate borrow share price.
4. Observe totalBorrowShares grows; virtual shares' asset equivalent compounds as interest accrues.
5. Final borrow of 1 ether reverts with `max uint128 exceeded`, showing share inflation ceiling.
**How found:** Code reading of _accrueInterest and withdrawable-funds formula (supplyAssets - borrowAssets) revealed virtual borrow shares earn interest despite having no owner or virtual collateral counterpart; test built to inflate share price and confirm.
**Exploitation:** Attacker inflates borrow share price via repeated tiny-share borrows so the unowned virtual borrow shares represent arbitrarily large assets, maximizing the bad debt/supply reduction; no direct extraction described beyond griefing withdrawable funds.
**Escalation:** Share price inflation amplifies the 1-asset virtual debt arbitrarily high, worsening the withdrawable-funds shortfall.
**Insight:** In share-based lending accounting, check whether the virtual-share offset used to prevent inflation also participates in interest accrual—unowned shares that earn yield silently become bad debt and can be amplified by manipulating share price.
