Open c4-bot-6 opened 11 months ago
DadeKuma marked the issue as primary issue
DadeKuma marked the issue as sufficient quality report
lumtis (sponsor) acknowledged
0xean marked the issue as satisfactory
0xean marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-11-zetachain/blob/b237708ed5e86f12c4bddabddfd42f001e81941a/repos/node/x/crosschain/keeper/verify_proof.go#L57-L104
Vulnerability details
Impact
Certain inbound transactions can not be added to the inbound transaction tracker due to the inability to verify their legitimacy, potentially resulting in missed inbound transactions.
Proof of Concept
Anyone can submit inbound transactions to ZetaChain's
InTxTracker
via theMsgAddToInTxTracker
message in case the transaction was missed by the observers in the first place, to ensure the transaction is processed.The
AddToInTxTracker
function handles theMsgAddToInTxTracker
message and ensures that the submitted transaction is a valid inbound transaction by verifying the provided block inclusion proof in line28
.After verifying if the transaction is included in the block, the transaction is checked if it is a valid inbound transaction by calling the
VerifyEVMInTxBody
function in line34
.The
VerifyEVMInTxBody
function checks in lines75
and84
if the transaction'sTo
address is the expected address for the given coin type. For example, if the coin type iscommon.CoinType_ERC20
, theTo
address must match the address of theERC20Custody
contract. Otherwise, if theTo
address is not the expected address, the transaction is considered invalid and not added to the inbound transaction tracker.However, this check is not sufficient to reliably determine if the transaction is a valid inbound tx.
Specifically, if the
ERC20Custody.deposit
function was called from another contract, thus the transaction'sTo
address is not theERC20Custody
contract address, the transaction can not be added to the tracker, even though it is a valid inbound transaction. Potentially resulting in a missed inbound transaction.Similarly, the
common.CoinType_Zeta
coin type is also affected.For completeness, I'd like to point out that for the
common.CoinType_Gas
coin type, if a contract sends native gas tokens to the TSS address, it is not possible to determine if the transaction is a valid inbound transaction.Tools Used
Manual review
Recommended mitigation steps
Consider also allowing to provide the logged event (log) and the accompanying proof of the event inclusion by verifying the receipt merkle trie proof.
Assessed type
Invalid Validation