Skip to content
Business logic Audit finding Advanced

ZETA token supply keeps growing on failed `onReceive()` contract calls

ZETA tokens minted to the fungible module account are not burned when the subsequent onReceive() EVM call reverts, so the total supply increases. An attacker can repeatedly trigger this to reach the 1.85 billion cap, causing a denial of service for ZETA deposits.

berndartmueller Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-04-zetachain-cross-chain-judging/issues/323

This issue has been acknowledged by the team but won't be fixed at this time.

Found by

berndartmueller

Summary

ZETA tokens minted to the fungible module account are not burned/reverted if the onReceive() ZEVM call reverts, which keeps increasing the total supply of ZETA tokens. This can lead to a denial of service (DoS) for ZETA deposits on ZetaChain, as the cap of 1.85 billion ZETA tokens is reached.

Root Cause

In CallOnReceiveZevmConnector(), ZETA tokens are first minted to the fungible module by calling DepositCoinsToFungibleModule(), so that the subsequent EVM call has sufficient native tokens (ZETA) to attach.

If we follow the code path up,

we notice that in InitiateOutbound() a temporary context tmpCtx is used and passed down to the chain of function calls.

This temporary context is committed, i.e., the state is written, if the CCTX's outbound is either successfully mined or if the CCTX will get reverted:

Go
58: newCCTXStatus = c.crosschainKeeper.ValidateOutboundZEVM(ctx, config.CCTX, err, isContractReverted)
59: if newCCTXStatus == types.CctxStatus_OutboundMined || newCCTXStatus == types.CctxStatus_PendingRevert {
60: 	commit()
61: }

However, if the onReceive() EVM call in CallOnReceiveZevmConnector() reverts (e.g., the target contract reverts), the ZETA tokens remain minted to the fungible module while reverting the CCTX and thus refunding the ZETA tokens to the sender on the external chain (e.g., Ethereum).

As a result, ZETA tokens are minted out of thin air to the fungible module account, which increases the total supply of ZETA tokens. This is a problem as the ZETA token has a cap of 1.85 billion ZETA tokens, checked by validateZetaSupply(). If the cap is reached, minting ZETA tokens will fail and thus prevents ZETA deposits on ZetaChain. This is effectively a DoS.

Same also in case of processFailedZETAOutboundOnZEVM() (which internally calls CallOnRevertZevmConnector() that also mints ZETA tokens to the fungible module without a temporary context). However, due to aborting the CCTX in case of the failed revert, without refunding the funds immediately, it does not invite for an attack. Reclaiming the funds would require an admin to refund them via the MsgRefundAbortedCCTX message.

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

Given ZETA at the time of the review is valued at ~$0.25 USD. And an attacker has a ZEVM contract deployed on ZetaChain that reverts in onReceive().

An attacker can purposefully trigger the 1.85B ZETA supply cap by repeating the following steps:

  1. On Ethereum, initiate a ZETA token inbound via ZetaConnectorEth.send() to ZetaChain with 10M ZETA tokens, worth $2.5M USD.
  2. CCTX inbound errors on ZetaChain when executing the onReceive() call on the target contract. The 10M ZETA tokens have been minted to the fungible module account.
  3. A revert outbound is created to refund the 10M ZETA tokens to the sender on Ethereum. 4. Attacker receives the 10M ZETA tokens back on Ethereum.

Repeat 185 times until the cap is reached.

The gas fees are negligible. Also, the capital is returned to the attacker after each iteration, reducing the risk of failure.

Impact

ZETA deposits and message passing via ZetaChain are halted. A network upgrade is required to burn the fungible module account ZETA tokens.

PoC

Add the following test case to node/x/fungible/keeper/evm_test.go and run with

Bash
go test -timeout 30s -run ^TestKeeper_CallOnReceiveZevmConnector$/^AUDIT_should_error_in_contract_call_reverts_but_ZETA_is_minted_to_fungible_module_account$ github.com/zeta-chain/node/x/fungible/keeper
Diff
diff --git a/node/x/fungible/keeper/evm_test.go b/node/x/fungible/keeper/evm_test.go
--- node/x/fungible/keeper/evm_test.go
+++ node/x/fungible/keeper/evm_test.go
@@ -19,8 +19,9 @@
 	"github.com/zeta-chain/protocol-contracts/pkg/systemcontract.sol"
 	"github.com/zeta-chain/protocol-contracts/pkg/wzeta.sol"
 	"github.com/zeta-chain/protocol-contracts/pkg/zrc20.sol"

+	zetaconfig "github.com/zeta-chain/node/cmd/zetacored/config"
 	"github.com/zeta-chain/node/e2e/contracts/dapp"
 	"github.com/zeta-chain/node/e2e/contracts/dappreverter"
 	"github.com/zeta-chain/node/e2e/contracts/example"
 	"github.com/zeta-chain/node/e2e/contracts/reverter"
@@ -1562,8 +1563,34 @@
 			dAppContract,
 			big.NewInt(45), []byte("message"), [32]byte{})
 		require.ErrorContains(t, err, "execution reverted")
 	})
+
+	t.Run("AUDIT should error in contract call reverts but ZETA is minted to fungible module account", func(t *testing.T) {
+		// add import "zetaconfig "github.com/zeta-chain/node/cmd/zetacored/config""
+		k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+		_ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+		deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+		dAppContract, err := k.DeployContract(ctx, dappreverter.DappReverterMetaData)
+		require.NoError(t, err)
+		assertContractDeployment(t, sdkk.EvmKeeper, ctx, dAppContract)
+
+		// check fungible module address cosmos bank coin ZETA balance before the call
+		beforeBalance := sdkk.BankKeeper.GetBalance(ctx, types.ModuleAddress, zetaconfig.BaseDenom)
+		require.Equal(t, "0", beforeBalance.Amount.String())
+
+		_, err = k.CallOnReceiveZevmConnector(ctx,
+			sample.EthAddress().Bytes(),
+			big.NewInt(1),
+			dAppContract,
+			big.NewInt(45), []byte("message"), [32]byte{})
+		require.ErrorContains(t, err, "execution reverted")
+
+		// check fungible module address cosmos bank coin ZETA balance after the call
+		afterBalance := sdkk.BankKeeper.GetBalance(ctx, types.ModuleAddress, zetaconfig.BaseDenom)
+		require.Equal(t, "45", afterBalance.Amount.String()) // 45 ZETA is minted to fungible module account
+	})
 }

 func TestKeeper_CallOnRevertZevmConnector(t *testing.T) {
 	t.Run("should call on revert on connector which calls onZetaRevert on sample DAPP", func(t *testing.T) {

The test demonstrates that ZETA tokens are minted to the fungible module account even if the contract call reverts.

Mitigation

Consider using another temporary context for both the ZETA token mint and the onReceive() EVM call to ensure atomicity. Same for the processFailedZETAOutboundOnZEVM() function.

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

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

Impact

ZETA deposits and message passing via ZetaChain are halted, requiring a network upgrade to burn the excess tokens.

What the attacker needed

Attacker has a ZEVM contract that reverts in onReceive(); attacker has 10M ZETA tokens on Ethereum; attacker can send tokens via ZetaConnectorEth

The fix

The mint and the onReceive() call should be made atomic by using a separate temporary context for both, and the same for processFailedZETAOutboundOnZEVM().

How it was found

  1. On Ethereum, initiate a ZETA token inbound via ZetaConnectorEth.send() to ZetaChain with 10M ZETA tokens.
  2. The CCTX inbound errors on ZetaChain when executing the onReceive() call on the target contract, and the 10M ZETA tokens have been minted to the fungible module account.
  3. A revert outbound is created to refund the 10M ZETA tokens to the sender on Ethereum.
  4. The attacker receives the 10M ZETA tokens back on Ethereum.
  5. Repeat 185 times until the cap is reached.

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.

When you send ZETA tokens to ZetaChain, the system creates new tokens on ZetaChain and then calls a contract. If that contract call fails, the system should undo the token creation, but it does not. This means the total number of ZETA tokens can grow without limit, and once a maximum is reached, no more deposits can be processed.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by berndartmueller

View all

97 more disclosed reports, best first.

More from ZetaChain Cross-Chain

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.