Skip to content
DoS Audit finding Intermediate

The outbound transaction tracker only keeps track of a maximum of two different transaction hashes, preventing cctxs from being efficiently confirmed and blocking the outbound transaction queue

The outbound transaction tracker only stores up to two transaction hashes per pending cross-chain transaction. When gas price increases cause the transaction hash to change, observers cannot find the new hash, so the transaction remains stuck and blocks other pending transactions from being sent.

berndartmueller Follow with oakcobalt

Originally disclosed on Code4rena

Submitted by berndartmueller, also found by oakcobalt

The outbound transaction queue is potentially blocked by such “stuck” transactions, preventing other pending cctxs from being sent out.

Proof of Concept

The AddToOutTxTracker function, handling the MsgAddToOutTxTracker message, adds a transaction hash associated with a pending cctx to the outbound transaction tracker, which is subsequently watched by observers to detect the transaction’s inclusion and confirmation in a block. As a result, the pending cctx is marked as CctxStatus_OutboundMined.

This MsgAddToOutTxTracker message is sent by observers as soon as the outbound transaction is broadcast. See zetaclient/evm_signer.go#L585 and zetaclient/btc_signer.go#L360.

However, the AddToOutTxTracker function only keeps track of a maximum of two different transaction hashes, as seen in line 100. Otherwise, the msg.TxHash is discarded.

024: func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToOutTxTracker) (*types.MsgAddToOutTxTrackerResponse, error) {
...   // [...]
081:
082: 	var isDup = false
083: 	for _, hash := range tracker.HashList {
084: 		if strings.EqualFold(hash.TxHash, msg.TxHash) {
085: 			isDup = true
086: 			if isProven {
087: 				hash.Proved = true
088: 				k.SetOutTxTracker(ctx, tracker)
089: 				k.Logger(ctx).Info("Proof'd outbound transaction")
090: 				return &types.MsgAddToOutTxTrackerResponse{}, nil
091: 			}
092: 			break
093: 		}
094: 	}
095: 	if !isDup {
096: 		if isProven {
097: 			hash.Proved = true
098: 			tracker.HashList = append([]*types.TxHashList{&hash}, tracker.HashList...)
099: 			k.Logger(ctx).Info("Proof'd outbound transaction")
100: ❌		} else if len(tracker.HashList) < 2 {
101: 			tracker.HashList = append(tracker.HashList, &hash)
102: 		}
103: 		k.SetOutTxTracker(ctx, tracker)
104: 	}
105: 	return &types.MsgAddToOutTxTrackerResponse{}, nil
106: }

This is problematic as an outbound cctx, uniquely identified by its nonce, can have multiple different transaction hashes caused by repeatedly increasing the gas price every epoch.

As soon as the gas price has been increased and observers broadcast the updated transaction (i.e., replace it in the mempool), the transaction hash will change. As a result, reporting the transaction hash to ZetaChain via the AddTxHashToOutTxTracker function call will not keep track of the new transaction hash.

Consequently, the EVM client’s observeOutTx and the BTC client’s observeOutTx function are not able to query the transaction by the available hashes found in the tracker HashList. This results in the outbound cctx being repeatedly processed by the observers, unnecessarily “blocking” other pending cctxs from being sent out (due to limiting the amount of sent outbound cctx per the 3-second ticker).

Only after such a “stuck” transaction is manually added to the outbound transaction tracker via the AddTxHashToOutTxTracker function by providing a block inclusion proof, the correct and up-to-date transaction hash is added to the tracker and the observers can finally confirm and conclude the cctx. However, this is a separate process and requires (manual) intervention, which might take some time until it is noticed.

Recommended mitigation steps

Consider keeping track of all transaction hashes associated with a pending cctx instead of limiting it to two hashes.

lumtis (ZetaChain) acknowledged


The original report as published on Code4rena, by berndartmueller. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The tracker limits the number of stored transaction hashes to two, so later hashes from gas price increases are discarded.

Impact

The outbound transaction queue can be blocked by stuck transactions, preventing other pending cross-chain transactions from being sent out.

What the attacker needed

Gas price increase causes new tx hash; observers broadcast updated transaction

The fix

The tracker should keep all transaction hashes associated with a pending cross-chain transaction instead of limiting it to two.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A cross-chain transaction needs to be confirmed on another blockchain. The system keeps a list of possible transaction hashes to watch, but it only remembers two. If the transaction is re-sent with a higher fee, its hash changes, and the new hash is ignored. The system then cannot confirm the transaction, and it gets stuck, delaying other transactions.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by berndartmueller

View all

97 more disclosed reports, best first.

More from ZetaChain

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.