Reproduced Exploit
Chakra: a failed destination message still settles and burns the escrow
The Code4rena report is about the Cairo handler: receive_cross_chain_callback writes tx_status = SETTLED and, in mint-burn mode, burns the escrow even when the destination message failed. This playground is that handler in Solidity. A failed status still settles the source message and burns 1000 CH…
Loss
1000 CHK escrow burned and the message marked settled after a failed destination
Chain
Other
Category
logic
Date
Aug 2024
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 49145-h-12-handlers-receive-cross-chain-callback-will-always-set-t. Standalone Foundry PoC and full write-up: 49145-h-12-handlers-receive-cross-chain-callback-will-always-set-t_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/logic/wrong-condition·vuln/logic/state-update
Key info#
| Field | Value |
|---|---|
| Loss | 1000 CHK escrow burned and the message marked settled after a failed destination |
| Vulnerable contract | Handler.receiveCrossChainCallback |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Local synthetic · 2024-08 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | Callback ignores the destination status in mint-burn mode |
TL;DR#
The Code4rena report is about the Cairo handler: receive_cross_chain_callback writes tx_status = SETTLED and, in mint-burn mode, burns the escrow even when the destination message failed. This playground is that handler in Solidity. A failed status still settles the source message and burns 1000 CHK. The contest's Solidity handler burns only on success.
The vulnerable code#
function receive_cross_chain_callback(uint256 id, uint8 crossChainMsgStatus) external returns (bool) {
Created memory createdTx = created[id];
if (mode == MODE_MINT_BURN) {
token.transfer(sink, createdTx.amount);
}
created[id] = Created({amount: createdTx.amount, status: SETTLED});
return true;
}
The status argument is unread. A failed destination should leave the escrow in place and must not mark the source message settled.
Root cause#
The callback treats every destination result as success. Mint-burn mode then destroys the tokens that were waiting on the source chain.
Preconditions#
- Mint-burn mode, with 1000 CHK escrowed on the handler.
- The destination reports failure.
Attack walkthrough#
- The handler holds 1000 CHK for a pending message.
- The callback arrives with status failed.
txStatusis written as settled anyway.- The 1000 CHK is transferred to the burn sink. The handler balance is 0.
Diagrams#
Impact#
A failed cross-chain message still destroys the source escrow. This run burns 1000 CHK that should have stayed claimable.
How to reproduce#
cd 49145-h-12-handlers-receive-cross-chain-callback-will-always-set-t_exp
forge test -vv
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/49145-h-12-handlers-receive-cross-chain-callback-will-always-set-t.md
- Code4rena report: https://code4rena.com/reports/2024-08-chakra
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 49145-h-12-handlers-receive-cross-chain-callback-will-always-set-t_exp (evm-hack-registry mirror).
- AuditVault finding: 49145-h-12-handlers-receive-cross-chain-callback-will-always-set-t.
Alerts & third-party analyses
These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.