# Anyone can remove existing term without queueing through setTerms()

confirmTerms() is callable by anyone and trusts caller-supplied terms, letting an attacker zero out existing pool terms without owner's setTerms().

- Payout: Audit contest
- Severity: medium
- Program: Gondi
- Found by: minhquanym
- Disclosed: 2024-07-25
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-04-gondi-findings/issues/59
- Library page: https://bugbountylibrary.com/r/c4%3A2024-04-gondi%3AM-06
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:access-control vuln:business-logic

**Target:** PoolOfferHandler.confirmTerms()
**Root cause:** confirmTerms() lacks access control and uses caller-provided __terms instead of the stored pending terms; the pendingAprPremium check passes when pending value is 0, allowing arbitrary aprPremium writes.
**Steps:**
1. Owner calls `setTerms()` to queue a new term; after NEW_TERMS_WAITING_TIME it is confirmable.
2. Attacker calls `confirmTerms(_termKeys, __terms)` with _termKeys = all 5 existing terms and `__terms[i].aprPremium = 0`.
3. pendingAprPremium for existing terms is 0, so `pendingAprPremium != __terms[i].aprPremium` check passes.
4. `_terms[...]` mapping is overwritten to 0 for existing terms.
**How found:** Code review of confirmTerms(): noticed it is externally callable (no onlyOwner) and consumes caller-supplied __terms rather than stored pending terms, then traced the pendingAprPremium==0 bypass.
**Exploitation:** Attacker front-runs/races the owner's legitimate confirmation window, submitting confirmTerms() with existing term keys and aprPremium=0, resetting all existing pool terms to zero without any owner action.
**Insight:** When a two-step set/confirm pattern exists, check whether confirm trusts caller-supplied values instead of the stored pending state; a zeroed pending value can bypass equality checks and let anyone overwrite committed state.

