# Bridging from Starknet to Starknet causes mismatch between minted ckrBTC and BTC transferred to MuSig2

Chakra's Starknet ERC20 handler allows bridging to the same chain/handler, so locked ckrBTC is re-minted on Starknet, inflating supply beyond BTC held in MuSig2.

- Payout: Audit contest
- Severity: medium
- Program: Chakra
- Found by: fyamf
- Disclosed: 2025-02-20
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2024-08-chakra-findings/issues/46
- Library page: https://bugbountylibrary.com/r/c4%3A2024-08-chakra%3AM-09
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:medium tech:solidity technique:chained technique:source-review vuln:accounting-error vuln:business-logic

**Target:** Starknet ERC20 handler / settlement bridge contract
**Root cause:** receive_cross_chain_msg only checks that to_chain/to_handler are in support_handler, and the handler's own chain/address must be whitelisted, so a message with from==to passes and LockMint mints again what was just locked.
**Steps:**
1. Owner has whitelisted (Starknet, handler_erc20) in support_handler (required for normal operation).
2. Attacker approves handler for amount of ckrBTC and calls `cross_chain_erc20_settlement('Starknet', handler_erc20, ckrBTC, recipient, amount)` — to_chain/to_handler equal from_chain/from_handler.
3. Validators sign the event; settlement::receive_cross_chain_msg forwards to handler_erc20::receive_cross_chain_msg.
4. support_handler check passes since (Starknet, handler) is whitelisted; LockMint locks the amount then mints the same amount to recipient on Starknet.
5. Attacker repeats to inflate ckrBTC supply; PoC test `test_lock_mint_self` shows 1000 locked and 1000 minted.
**How found:** Noticed the odd requirement that the handler's own chain and address must be added to support_handler, hypothesized that a self-referential bridge message would pass the whitelist check, and wrote a Foundry test confirming double minting.
**Exploitation:** Attacker with ckrBTC calls cross_chain_erc20_settlement targeting Starknet itself; after validator signing, the same handler receives the message and mints an equal amount, so locked tokens are duplicated as new supply, breaking the 1:1 backing with BTC in MuSig2.
**Insight:** When a bridge whitelists destination handlers, check whether the contract's own chain/handler is whitelisted and whether from==to is rejected; self-referential messages can turn lock-and-mint into mint-and-mint.

