# Missing ERC20Method validation at destination allows non-transfer tx to be handled as transfers

Chakra's Solidity settlement handler decodes ERC20 payloads but never checks method_id==TRANSFER, so non-transfer cross-chain messages get processed as token mints/unlocks.

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

**Target:** ChakraSettlementHandler::receive_cross_chain_msg (Solidity cross-chain settlement handler)
**Root cause:** The destination-side Solidity handler decodes the ERC20 transfer payload and immediately mints/unlocks tokens without asserting transfer_payload.method_id == ERC20Method.Transfer, unlike the Cairo handler_erc20 counterpart which does assert it.
**Steps:**
1. Send a cross-chain message with payload_type == PayloadType.ERC20 but method_id set to a non-TRANSFER ERC20Method
2. Destination ChakraSettlementHandler::receive_cross_chain_msg decodes payload via codec.deocde_transfer(msg_payload)
3. No check on transfer_payload.method_id; code proceeds to _erc20_mint(to, amount) in MintBurn mode (or unlock path)
4. Tokens are minted/unlocked at destination despite the message not being a transfer
**How found:** Compared the Cairo handler_erc20::receive_cross_chain_msg, which asserts ERC20Method::TRANSFER, against the Solidity ChakraSettlementHandler::receive_cross_chain_msg, spotting the missing equivalent validation after payload decoding.
**Exploitation:** A cross-chain message whose ERC20Method is not TRANSFER is accepted at the destination and handled as a token transfer, minting/unlocking the encoded amount to the encoded recipient. Feasibility depends on the out-of-scope Chakra node allowing such a method_id to reach the handler.
**Insight:** When a protocol has parallel implementations across chains/languages (Cairo vs Solidity), diff the validation logic between them; a check present on one side and absent on the other is a strong bug signal.

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

**Solidity receive_cross_chain_msg missing ERC20Method validation**

```
if (payload_type == PayloadType.ERC20) {
            // Cross chain transfer
            {
                // Decode transfer payload
                ERC20TransferPayload memory transfer_payload = codec
                    .deocde_transfer(msg_payload);
>>              // @audit-info Missing method validation
                if (mode == SettlementMode.MintBurn) {
                    _erc20_mint(
                        AddressCast.to_address(transfer_payload.to),
                        transfer_payload.amount
                    );
                    return true;
                }
                ---SNIP---
```

**Cairo destination ERC20Method TRANSFER assertion**

```
assert(transfer.method_id == ERC20Method::TRANSFER, 'ERC20Method must TRANSFER');
```

