# Denial of service when baseAmount is equal to zero

A bidder submits an encrypted bid with baseAmount=0, causing mulDivDown division-by-zero in finalize and permanently blocking auction finalization.

- Payout: Contest reward
- Severity: medium
- Program: SIZE
- Credited: V\_B
- Disclosed: 2023-01-09
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-11-size-findings/issues/332
- Library page: https://bugbountylibrary.com/r/c4%3A2022-11-size%3AM-07
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:dos

**Target:** SizeSealed.finalize auction settlement routine
**Root cause:** finalize computes quotePerBase = mulDivDown(quoteAmount, type(uint128).max, baseAmount) without checking baseAmount; a decrypted bid with baseAmount=0 makes the divisor zero and reverts the whole finalize transaction.
**Steps:**
1. Create auction with totalBaseAmount and short timings.
2. Bid with encrypted message where first 128 bits (baseAmount) are 0 and quoteAmount=1, commitment=keccak256(message).
3. After endTimestamp, call reveal(auctionId, privateKey, "").
4. Call finalize(auctionId, [0], type(uint128).max, type(uint128).max) — reverts in FixedPointMathLib.mulDivDown due to division by zero.
5. Any honest finalize attempt including this bid index reverts, leaving auction unfinalizable.
**How found:** Code review of finalize loop: noticed quotePerBase divides by baseAmount derived from decrypted message with no zero check, and mulDivDown reverts on zero denominator.
**Exploitation:** Attacker places a cheap valid bid with baseAmount=0; since finalize iterates all bids and reverts on the zero divisor, the auction can never be settled, locking seller/bidder funds and wasting gas.
**Insight:** In auction settlement loops, any per-bid arithmetic derived from user-supplied decrypted data (divisors, array indices) is a poison-pill vector: one malformed but validly-committed bid can revert the entire batch settlement.
