# Borrowers can burn stability fees instead of transferring them to the treasury

Borrowers set sf_transfer_amount to zero and drive PRINCIPAL negative in vault_repay.clsp, burning stability fees owed to the treasury.

- Payout: Contest reward
- Severity: high
- Program: Circuit Puzzles
- Credited: muellerberndt
- Disclosed: 2025-08-21
- Write-up quality: 7/10
- Original: https://cdn.cantina.xyz/reports/cantina_competition_circuit_puzzles.pdf#3.2.1
- Library page: https://bugbountylibrary.com/r/cantina%3Acircuit_puzzles%3A3.2.1
- Tags: domain:web3 impact:funds-loss impact:integrity kind:contest platform:cantina sev:high technique:source-review vuln:accounting-error vuln:business-logic vuln:fee-bypass

**Target:** Chia Clarity-style vault_repay.clsp smart contract (BYC stablecoin collateral vault)
**Root cause:** vault_repay.clsp trusts a user-supplied sf_transfer_amount and permits the curried PRINCIPAL argument to go negative, so repaying principal+interest with zero fee transfer settles the debt while fees are never sent to treasury.
**Steps:**
1. Open vault A, deposit collateral, borrow 5,000 BYC accruing stability fees.
2. Open vault B with same owner and borrow principal+expected_fees BYC.
3. Call `CollateralVault.repay(vault_a_spend, acs, treasury_spend, repay_byc_cwc, fresh_statutes_for_repay, total_repay_amount, sim.timestamp, sf_transfer_amount=uint64(0), target_puzzle_hash=acs_ph)`.
4. Push repay bundle; PRINCIPAL becomes negative, DISCOUNTED_PRINCIPAL zero, debt settled with zero treasury fee.
5. Withdraw collateral from vault A and repeat.
**How found:** Code review of vault_repay.clsp spotted two flaws: treasury fee amount is a user-supplied argument, and PRINCIPAL curried argument lacks a non-negative assertion; worked example with 40 BYC interest on 1,000 BYC principal showed PRINCIPAL falling to -40.
**Exploitation:** Borrower repays full principal plus accrued interest but passes sf_transfer_amount=0, so the entire repayment settles the debt while treasury receives nothing; collateral is then withdrawable and the loop can be repeated, draining treasury below TREASURY_MIN and triggering recharge auctions borrowers can buy CRT cheaply.
**Escalation:** Repeated across vaults/loans to push treasury under TREASURY_MIN and profit from discounted CRT recharge auctions.
**Insight:** In collateralized stablecoin vaults, check whether fee/transfer amounts are caller-supplied and whether debt accounting variables are bounded; a negative principal after full repayment is a tell that fee accounting can be zeroed.
