Submitted by 0x18a6, also found by Abdessamed, mjcpwns, and jesjupyter
The BurnUnlock mode in the ChakraSettlementHandler contract has a critical flaw that causes token loss on both chains. This happens because tokens are burned on the source chain before ensuring a successful unlock on the destination chain. This high-risk vulnerability can lead to significant financial loss and damage trust in the cross-chain bridge system.
Note that the same issue persists in the Cairo code.
In the ChakraSettlementHandler contract, we got two modes that burns tokens in the bridging process:
We observe two distinct pattern of burning tokens in MintBurn vs BurnUnlock modes:
MintBurn mode
solidity/handler/contracts/ChakraSettlementHandler.sol#L123-L124
solidity/handler/contracts/ChakraSettlementHandler.sol#L325-L329
solidity/handler/contracts/ChakraSettlementHandler.sol#L383-L389
BurnUnlock mode
solidity/handler/contracts/ChakraSettlementHandler.sol#L129-L130
solidity/handler/contracts/ChakraSettlementHandler.sol#L344-L348
To summarize, the two distinct pattern for burning tokens is that: MintBurn follows a lock (source) -> mint (dest) -> burn (callback) and, BurnUnlock follows a burn (source) -> unlock (dest).
The problem is that in the BurnUnlock mode, if the execution on the destination chain fails (for instance, due to insufficient validator signatures), the users tokens are lost on both chains. This is because the tokens are burned on the source chain and remain locked on the destination chain, preventing the user from reclaiming them at first try, and preventing the user from reclaiming them at a latter try because user already burned their equivalant tokens in the source chain.
Note that the problem doesnt exist in MintBurn mode (at least with this particular root cause) because we use the callback pattern. If the call to destination chain fails, the callback simply unlocks the tokens back on the source chain (which it doesnt do in the current implementation, but is a subject of a distinct report since its a different root cause i.e, not implementing a callback pattern if bridging fails vs not unlocking the tokens back in the callback pattern if bridging fails).
Heres a scenario to illustrate:
pidb (Chakra) disputed and commented:
0xsomeone (judge) decreased severity to Medium and commented:
