# Malicious users can donate/leave dust amounts of collateral in contract during auctions to buy other collateral at very low prices

Auction only closes when collateral balance hits zero, so leaving 1 wei of dust keeps the auction alive and price decaying, letting buyers scoop later collateral cheaply.

- Payout: Contest reward
- Severity: medium
- Program: Hubble Exchange
- Credited: 0x3e84fa45
- Disclosed: 2023-04-16
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2023-04-hubble-exchange-judging/issues/168
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-04-hubble-exchange%3AM-8
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** InsuranceFund auction buyCollateralFromAuction
**Root cause:** Auction termination is gated on IERC20(token).balanceOf(address(this)) == 0, so any residual dust (1 wei) keeps the auction open and the discount timer running.
**Steps:**
1. Call `buyCollateralFromAuction(token, amount)` buying all but 1 wei of the auctioned token, leaving balance != 0.
2. Auction remains ongoing; startedAt not reset, price keeps decaying.
3. Alternatively frontrun a buyer's purchase with a 1 wei `transfer` of the same token to the InsuranceFund to keep balance nonzero.
4. Wait for new collateral to be added mid-auction, which starts at the already-discounted price.
5. Buy the fresh collateral at the depressed price via `buyCollateralFromAuction`.
**How found:** Code reading of buyCollateralFromAuction: noticed the close condition checks exact zero balance, then reasoned that dust or a frontrun 1 wei transfer would prevent closure and keep the discount timer running.
**Exploitation:** Attacker leaves or donates 1 wei of the auctioned token so the auction never closes; the decaying price means any collateral subsequently added to the fund is purchasable far below market, extracting value from the insurance fund.
**Insight:** When an auction/vesting/liquidation state machine closes on an exact-zero balance check, look for ways an attacker can keep the balance nonzero (dust, direct transfer, frontrun) to extend the decaying-price window.
