Incorrect argument order in CrossChainHandleResult
event emission leads to incorrect cross-chain message finalization
#528
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-129
grade-a
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_18_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-chakra/blob/abef77d95866f2fec93270491fc5abc9ab14f86d/solidity/settlement/contracts/ChakraSettlement.sol#L238-L241
Vulnerability details
Impact
When a cross-chain ERC20 transfer is initiated, the destination
ChakraSettlement
contract processes the message via thereceive_cross_chain_msg
function and emits aCrossChainHandleResult
event. This event is crucial for Chakra validators, as they rely on its arguments to correctly callChakraSettlement::receive_cross_chain_callback
on the source chain to finalize the message.The issue lies in the incorrect ordering of arguments in the
CrossChainHandleResult
event. This misordering causes the validators to pass incorrect values to thereceive_cross_chain_callback
function, leading to improper message finalization:As shown above, the
receive_cross_chain_msg
function incorrectly sets the arguments in theCrossChainHandleResult
event. When Chakra validators capture this event and use it to callreceive_cross_chain_callback
on the source chain, the wrong values are passed to the function. For instance, thefrom_chain
argument in the event emission inreceive_cross_chain_callback
ends up referring to the source chain itself, rather than the intended destination chain that handled the receive message.Tools Used
Manual Review
Recommended Mitigation Steps
Ensure that the arguments in the
CrossChainHandleResult
event are correctly ordered:Assessed type
Other
The text was updated successfully, but these errors were encountered: