# Bracket and StopLimit contracts are vulnerable to DoS attacks.

Orders with recipient=address(0) and USDT as tokenIn cannot be cancelled by admin, letting users fill maxPendingOrders and DoS Bracket/StopLimit.

- Payout: Audit contest
- Severity: medium
- Program: Oku
- Found by: Contest-Squad
- Disclosed: 2024-11-22
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-11-oku-judging/issues/72
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-oku%3AM-1
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:dos

**Target:** Bracket and StopLimit automated-trigger order contracts
**Root cause:** _cancelOrder refunds tokenIn via safeTransfer to order.recipient, but recipient is unconstrained at creation and can be address(0); USDT reverts on transfers to the zero address, so such orders can never be cancelled.
**Steps:**
1. Create orders on Bracket/StopLimit with tokenIn=USDT and recipient=address(0), using stopPrice/takeProfit values that never execute.
2. Repeat until pendingOrderIds length reaches AutomationMaster.maxPendingOrders.
3. Admin attempts _cancelOrder on each; safeTransfer to address(0) reverts for USDT, so orders cannot be removed.
4. Admin can only raise maxPendingOrders; repeat until array traversal exceeds block gas limit, bricking the contracts.
**How found:** Reviewer noticed _cancelOrder refunds to order.recipient and that recipient has no zero-address check at creation, then cross-referenced USDT's transfer revert on address(0) to conclude orders become uncancellable.
**Exploitation:** Attacker fills the pending order array with inexecutable USDT orders whose recipient is address(0). Because USDT's _transfer reverts on recipient==address(0), the admin's cancellation path always reverts, so the array cannot be drained; iterating it eventually exceeds block gas limit, causing complete DoS.
**Escalation:** Repeatedly refill after each maxPendingOrders increase until gas to traverse the array exceeds the block gas limit.
**Insight:** When a refund/cancel path transfers to a user-supplied recipient, check whether the token reverts on address(0) or blocked addresses; a missing recipient validation can turn a bounded queue into a permanent DoS because the admin's cleanup path itself reverts.

