# AuctionEschapeHatch.sol#exitEarly updates state of the auction wrongly

Malt Finance auction exitEarly subtracts full amount but only penalized maltQuantity, inflating userMaltPurchased/userCommitment ratio so users claim excess malt and dodge profit penalties.

- Payout: Audit contest
- Severity: high
- Program: Malt Finance
- Found by: 0x0x0x
- Disclosed: 2022-02-14
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2021-11-malt-findings/issues/268
- Library page: https://bugbountylibrary.com/r/c4%3A2021-11-malt%3AH-05
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** AuctionEschapeHatch.sol exitEarly / auction accounting
**Root cause:** exitEarly calls auction.amendAccountParticipation() subtracting the full `amount` from userCommitment but only the penalty-reduced maltQuantity from userMaltPurchased, so the maltQuantity/commitment ratio drifts upward after each profitable exit.
**Steps:**
1. User participates in auction, establishing userMaltPurchased and userCommitment.
2. Call `exitEarly(amount)` with profit; contract computes maltQuantity via `_calculateMaltRequiredForExit` applying profit penalty.
3. amendAccountParticipation subtracts full `amount` from userCommitment but only penalized maltQuantity from userMaltPurchased.
4. Ratio userMaltPurchased/userCommitment increases; repeat or split exitEarly calls to compound the drift.
5. Later exits compute `maltQuantity = userMaltPurchased.mul(amount).div(userCommitment)`, yielding more malt per commitment than entitled.
6. After userMaltPurchased exhausted, leftover userCommitment can be used in claimArbitrage.
**How found:** Code review of exitEarly and amendAccountParticipation, noticing asymmetric subtraction of amount vs penalized maltQuantity and tracing how _calculateMaltRequiredForExit uses the ratio.
**Exploitation:** Attacker repeatedly calls exitEarly (or splits calls) to inflate the maltQuantity/commitment ratio, extracting more malt than deserved and reducing profit penalties; residual commitment enables claimArbitrage.
**Escalation:** Splitting exitEarly into multiple calls further reduces penalties and amplifies ratio drift.
**Insight:** When a penalty is applied to one side of a ratio but the full amount is deducted from the other, the ratio drifts in the user's favor; check every accounting update for asymmetric subtraction and test splitting calls to compound drift.
