# Price Calculation Division by Zero and Fee Transfer Bypass in Vault Liquidation Bidding

Unguarded division in vault_keeper_bid.clsp lets auction price hit zero/negative, so a 1-mojo BYC bid claims entire XCH vault collateral plus phantom treasury credits.

- Payout: Contest reward
- Severity: medium
- Program: Circuit Puzzles
- Credited: chainsentry
- Disclosed: 2025-08-21
- Write-up quality: 6/10
- Original: https://cdn.cantina.xyz/reports/cantina_competition_circuit_puzzles.pdf#3.3.4
- Library page: https://bugbountylibrary.com/r/cantina%3Acircuit_puzzles%3A3.3.4
- Tags: domain:web3 impact:funds-loss impact:integrity kind:contest platform:cantina sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:dos

**Target:** vault_keeper_bid.clsp auction price/collateral calculation (Chialisp/CLVM)
**Root cause:** Auction price subtraction (start_price*PRECISION_BPS - start_price*step_price_decrease_factor*elapsed_steps) is not validated to stay >0 before being used as a divisor, and treasury BYC deposits are credited from SEND_MESSAGE claims without proof of BYC inputs.
**Steps:**
1. Set auction params so step_price_decrease_factor * elapsed_steps >= PRECISION_BPS (e.g. 300 BPS * 40 steps = 12000 > 10000).
2. Wait until elapsed_steps reaches that threshold so auction_price = start_price*10000 - start_price*total_decrease <= 0.
3. Bid `byc_bid_amount = 1` mojo; collateral formula `(/ (* byc_bid_amount PRECISION_BPS PRICE_PRECISION MOJOS) (* auction_price 1000))` yields astronomically large or div-by-zero.
4. Result is clamped only by `(if (> bid_xch_collateral_amount_pre COLLATERAL) COLLATERAL ...)`, so claim full vault collateral.
5. Send SEND_MESSAGE 0x3f to treasury claiming byc_to_treasury without providing BYC coin inputs, inflating treasury balance.
**How found:** Code review of the collateral division formula; noticed the denominator can reach zero/negative when cumulative step decrease exceeds PRECISION_BPS, and that SEND_MESSAGE treasury notifications lack corresponding BYC coin inputs.
**Exploitation:** Attacker waits for auction price to decay to zero/negative under normal governance params (5% per step, 10-min steps, 4h max duration), bids 1 mojo BYC, receives entire vault XCH collateral (e.g. 100 XCH ~ $300k) for a transaction fee, and simultaneously messages treasury to credit phantom BYC deposits.
**Escalation:** Phantom treasury credits suppress Recharge Auctions and enable excessive Surplus Auctions burning legitimate CRT against fake reserves, compounding protocol insolvency.
**Insight:** In auction/decay pricing, check whether cumulative step decrease can exceed the precision constant within max auction duration; any divisor derived from a decaying price needs an explicit >0 assert, and cross-contract balance updates via SEND_MESSAGE must be backed by RECEIVE_MESSAGE-verified coin inputs.
