# Users can get their Kerosene stuck until TVL becomes greater than Dyad's supply

UnboundedKerosineVault::assetPrice computes tvl - dyad.totalSupply(), underflowing and reverting until TVL exceeds Dyad supply, trapping deposited Kerosene.

- Payout: Audit contest
- Severity: high
- Program: DYAD
- Found by: 0xAlix2
- Disclosed: 2024-06-17
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-04-dyad-findings/issues/308
- Library page: https://bugbountylibrary.com/r/c4%3A2024-04-dyad%3AH-08
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity vuln:accounting-error vuln:dos

**Target:** UnboundedKerosineVault::assetPrice / VaultManagerV2 withdraw
**Root cause:** assetPrice uses numerator = tvl - dyad.totalSupply() without guarding against tvl < totalSupply, so the subtraction underflows and reverts.
**Steps:**
1. Fork mainnet at block 19703450, deploy V2 contracts
2. Mint DNft for bob, add ethVault and unboundedKerosineVault via add/addKerosene
3. Deposit 1e18 WETH and 1e18 Kerosene into respective vaults
4. Call `vaultManagerV2.withdraw(bobNFT, address(unboundedKerosineVaultV2), 1e18, bob)`
5. Observe revert from underflow in assetPrice since tvl < dyad.totalSupply()
**How found:** Reading UnboundedKerosineVault::assetPrice, noticed numerator subtracts dyad.totalSupply() from tvl; realized TVL (~600k) is below Dyad supply so the subtraction underflows, blocking withdrawals.
**Insight:** When a price/oracle formula subtracts a protocol-wide aggregate (total supply) from a per-vault TVL, check ordering of magnitudes at launch — early-state underflow can brick deposit/withdraw paths even without attacker action.

