# Forcing Starknet handlers to be whitelisted on the same chain allows exploit of BurnUnlock mode to drain handler funds

Starknet handlers must self-whitelist, letting a user send same-chain cross-chain messages in BurnUnlock mode to repeatedly unlock and drain handler tokens.

- Payout: Audit contest
- Severity: high
- Program: Chakra
- Found by: Abdessamed
- Disclosed: 2025-02-20
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2024-08-chakra-findings/issues/162
- Library page: https://bugbountylibrary.com/r/c4%3A2024-08-chakra%3AH-06
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity technique:chained technique:source-review vuln:access-control vuln:business-logic

**Target:** Cairo cross-chain settlement handler (handler_erc20) on Starknet
**Root cause:** receive_cross_chain_msg requires the to_handler on the same chain to be whitelisted, forcing Starknet handlers to register themselves; combined with BurnUnlock mode, a same-chain message burns nothing meaningful but unlocks tokens on receipt.
**Steps:**
1. Handler operates in BurnUnlock mode with token balance backing unlocks.
2. Owner must have self-whitelisted the Starknet handler via set_support_handler for receive_cross_chain_msg to pass.
3. Attacker sends a cross-chain message from Starknet to Starknet targeting the handler with a transfer payload to attacker address.
4. On receipt, BurnUnlock branch executes `token.transfer(attacker, amount)` unlocking tokens.
5. Repeat to drain handler's ERC20 balance, breaking legitimate cross-chain ERC20 operations.
**How found:** Code reading of receive_cross_chain_msg/receive_cross_chain_callback asserts revealed the to_handler must be whitelisted on the same chain, implying self-whitelisting; combined with BurnUnlock transfer-on-receive logic to derive a drain path.
**Exploitation:** Attacker repeatedly submits same-chain (Starknet->Starknet) cross-chain messages to the whitelisted handler; each receipt triggers BurnUnlock's token.transfer to the attacker, draining handler funds without equivalent burn.
**Insight:** When a receive path asserts both source and destination handlers are whitelisted, check whether same-chain (self) routing is possible; a burn-on-send/unlock-on-receive mode then unlocks without a real burn.

