# ChakraSettlement.receive_cross_chain_msg and ChakraSettlement.receive_cross_chain_callback functions do not ensure that receiving ChakraSettlement contract's contract_chain_name must match to_chain corresponding to respective txid input though they should

ChakraSettlement.receive_cross_chain_msg/callback omit to_chain validation, letting validator signatures for one chain be replayed on another to mint or burn tokens.

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

**Target:** ChakraSettlement / ChakraSettlementHandler cross-chain message verification
**Root cause:** The signed message hash omits the destination chain name, and receive_cross_chain_msg/callback never check that the receiving contract's contract_chain_name matches the txid's to_chain, so a signature valid on chain A is also valid on chain B.
**Steps:**
1. Deploy validators and handler deterministically so they share addresses on to_chain A and B, with equal validator thresholds and same whitelisted from_chain-from_handler.
2. Validators sign a message_hash = keccak256(abi.encodePacked(txid, from_chain, from_address, from_handler, to_handler, keccak256(payload))) intended for chain A.
3. Submit the same txid/from_chain/from_address/from_handler/to_handler/payload/signatures to `ChakraSettlement.receive_cross_chain_msg` on chain B.
4. signature_verifier.verify returns true (same validator addresses/threshold), to_handler exists at same address, is_valid_handler passes.
5. Handler mints/unlocks tokens on chain B to the payload recipient; similarly replay `receive_cross_chain_callback` to trigger burn/settle logic on chain B.
**How found:** Code reading of the message_hash construction and receive functions, noticing to_chain/contract_chain_name is absent from the signed data and unvalidated, then reasoning about deterministic deployment giving identical addresses across chains.
**Exploitation:** Replay a validator-signed cross-chain message or callback on a second chain where validators/handler share addresses, causing the handler to mint or burn tokens on the wrong chain.
**Insight:** When a cross-chain message hash omits the destination chain identifier, check whether the receiving contract validates its own chain name against the txid's to_chain; deterministic deployments make addresses identical across chains, enabling replay.

