# Funds are locked because borrowFee is not correctly implemented in BigBang

BigBang adds borrowOpeningFee to user debt but only mints the principal, so total debt always exceeds USDO supply, permanently locking collateral.

- Payout: Contest reward
- Severity: high
- Program: Tapioca DAO
- Credited: 0x007
- Disclosed: 2023-11-16
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2023-07-tapioca-findings/issues/583
- Library page: https://bugbountylibrary.com/r/c4%3A2023-07-tapioca%3AH-51
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity technique:source-review vuln:accounting-error vuln:fee-bypass

**Target:** BigBang lending market contract (_borrow)
**Root cause:** _borrow mints only `amount` of USDO but records debt as `amount + feeAmount` in totalBorrow/userBorrowPart, so aggregate debt exceeds total USDO supply by the accumulated fees.
**Steps:**
1. Call `_borrow(from, to, 1000e18)` with borrowOpeningFee = 0.5% (FEE_PRECISION basis).
2. Observe `feeAmount = 5e18`; `totalBorrow.add(amount + feeAmount)` sets debt to 1005e18.
3. Only 1000e18 USDO is minted via `IUSDOBase.mint(address(this), amount)` and deposited to user.
4. Attempt full repay: user owes 1005e18 but only 1000e18 exists; extra 5e18 cannot be obtained, collateral remains locked.
**How found:** Code review of _borrow comparing the minted amount against the debt recorded in totalBorrow, noticing the fee is added to debt but never minted or collected.
**Exploitation:** No direct theft; the fee accounting mismatch means debt monotonically exceeds USDO supply, so borrowers can never fully repay and their collateral stays stuck in YieldBox, scaling with total borrow volume.
**Escalation:** Impact grows with cumulative mint/burn volume: e.g. 1B minted and 990M burned leaves 10M supply against 15M debt, locking 5M in collateral.
**Insight:** In CDP/lending markets, check that every unit added to recorded debt is actually minted or collectible; a fee added to debt without a matching mint creates an unrepayable debt-supply gap that locks collateral.
