Skip to content
Business logic Audit finding Intermediate

Abort processing after call originating from Solana will cause loss of funds

The Solana gateway contract incorrectly defines the abort address as a Solana public key instead of an EVM address, so when an abort occurs on ZetaChain, the funds are sent to a derived EVM address that the user cannot control. This results in permanent loss of the aborted funds.

Al-Qa-qa Follow with Goran

Originally disclosed on Sherlock

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

Found by

Al-Qa-qa, Goran

Summary

Solana implementation of the gateway assumes abort address is a Solana account, when in reality abort is always processed on ZetaChain (EVM chain). That means user can only provide Solana account for the abort address. When node processes abort it will convert provided value into a 20-byte EVM address and send the funds there. Effectively funds are then permanently lost since user (or no-one else) has no private key for the resulting EVM address.

Root Cause

ZetaChain introduced onAbort, a mechanism to prevent funds getting stuck after failed cross-chain transactions. Abort mechanism is a final fail-safe, in which protocol will move funds to a user-defined abort address in a case that both cross-chain action and the revert processing fail.

In case call originates from Connected chain flow is: Connected::depositAndCall -> ZetaChain::onCall fails -> Connected::onRevert fails (ie. out-of-gas) -> ZetaChain::onAbort

In case call originates from ZetaChain flow is: ZetaChain::depositAndCall -> Connected::onCall fails -> ZetaChain::onRevert fails (ie. out-of-gas) -> ZetaChain::onAbort

(Reference here)

Important to notice - onAbort is always processed on ZetaChain. So the onAbort target needs to be EVM address.

Let's look at one of Solana gateway's entrypoints, ie. deposit_and_call:

Rust
    pub fn deposit_and_call(
        ctx: Context<Deposit>,
        amount: u64,
        receiver: [u8; 20],
        message: Vec<u8>,
        revert_options: Option<RevertOptions>,
    ) -> Result<()> {
        instructions::deposit::handle_sol_with_call(
            ctx,
            amount,
            receiver,
            message,
            revert_options,
            DEPOSIT_FEE,
        )
    }

The last parameter is revert_options. The structure is defined like this:

Rust
pub struct RevertOptions {
    pub revert_address: Pubkey,
    pub abort_address: Pubkey,
    pub call_on_revert: bool,
    pub revert_message: Vec<u8>,
    pub on_revert_gas_limit: u64,
}

The main thing to notice here is that abort_address is defined as Pubkey (a Solana account) instead of [u8; 20] (a 20-bytes EVM address). So even though abort is always processed on ZetaChain, user can only provide Solana account as an abort address. As a result, protocol will send aborted funds to the wrong EVM address (the one resulting from the implicit conversion from the Solana account format), where they are permanently lost.

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

Impact

Instead of securing the funds when abort is processed, funds get permanently lost.

PoC

Bug is demonstrated by modifiying the existing e2e test SolanaDepositAndCallRevertWithDust:

Diff
func TestSolanaDepositAndCallRevertWithDust(r *runner.E2ERunner, args []string) {
	require.Len(r, args, 0)

	// deposit the rent exempt amount which will result in a dust amount (after fee deduction) in the revert outbound
	depositAmount := big.NewInt(constant.SolanaWalletRentExempt)
	
+	// @audit convert random EVM address to Solana format and use it as the abort address
+	evmAddress := common.HexToAddress("0x0397eE691dBf0f390DDeB7Edd328594e241CA9CB")
+       var abortPubkey solana.PublicKey
+       copy(abortPubkey[:20], evmAddress[:])

	// ACT
	// execute the deposit and call transaction
	nonExistReceiver := sample.EthAddress()
	data := []byte("dust lamports should abort cctx")
+	// @audit add the abort address to the RevertOptions
-       sig := r.SOLDepositAndCall(nil, nonExistReceiver, depositAmount, data, nil)
+	sig := r.SOLDepositAndCall(nil, nonExistReceiver, depositAmount, data,  &solanacontracts.RevertOptions{
+		AbortAddress: abortPubkey,
+	})

	// ASSERT
	// Now we want to make sure cctx is aborted.
	cctx := utils.WaitCctxAbortedByInboundHash(r.Ctx, r, sig.String(), r.CctxClient)
	require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.SolanaWalletRentExempt)
	require.True(
		r,
		strings.Contains(cctx.CctxStatus.ErrorMessageRevert, crosschaintypes.ErrInvalidWithdrawalAmount.Error()),
	)
	
+	// @audit check if evmAddress got the aborted funds
+	balance, err := r.SOLZRC20.BalanceOf(&bind.CallOpts{}, evmAddress)
+	require.NoError(r, err)
+	require.Equal(r, balance, depositAmount)
}

Now let's run the modified test in the localnet:

Bash
❯ make solana
❯ E2E_ARGS='--verbose --test-filter solana_deposit_and_call_revert_with_dust' make start-solana-test

And check logs:

Bash
❯ docker logs -f orchestrator
...
solana       | 🏃 starting Solana tests
solana       | [INFO] SolanaDeployerAddress: 37yGiHAnLvWZUNVwu9esp74YQFqxU1qHCbABkDvRddUQ
solana       | ⏳ running   - solana_deposit_and_call_revert_with_dust
solana       | [INFO] computed pda for gateway program: 9dcAyYG4bawApZocwZSyJBi9Mynf5EuKAJfifXdfkqik, bump 253

solana       | [INFO] Latest valid block height for tx 581
solana       | [INFO] Broadcast start
solana       | [INFO] Broadcast once start
solana       | [INFO] Broadcast success! tx sig wApP7UV6QFnjUbHb7RWi6RbEEGmJFGG5TGdEAHQJc5Y3MXVm9zPCkXU43Uq9fPHKL41UKRATYobT7wscuWTtgBE; waiting for confirmation...
solana       | [INFO] Current block height 444
solana       | [INFO] Broadcast once finished, tx: wApP7UV6QFnjUbHb7RWi6RbEEGmJFGG5TGdEAHQJc5Y3MXVm9zPCkXU43Uq9fPHKL41UKRATYobT7wscuWTtgBE, confirmed: true
solana       | [INFO] Tx broadcasted and confirmed
solana       | [INFO] deposit logs: [Program ComputeBudget111111111111111111111111111111 invoke [1] Program ComputeBudget111111111111111111111111111111 success Program ComputeBudget111111111111111111111111111111 invoke [1] Program ComputeBudget111111111111111111111111111111 success Program 94U5AHQMKkV5txNJ17QPXWoh474PheGou6cNP2FEuL1d invoke [1] Program log: Instruction: DepositAndCall Program 11111111111111111111111111111111 invoke [2] Program 11111111111111111111111111111111 success Program log: Deposit executed: amount = 1000000, fee = 2000000, receiver = [53, 18, 47, 131, 192, 214, 203, 187, 121, 186, 136, 71, 61, 194, 162, 232, 14, 2, 212, 168], pda = 9dcAyYG4bawApZocwZSyJBi9Mynf5EuKAJfifXdfkqik, revert options = Some(RevertOptions { revert_address: 11111111111111111111111111111111, abort_address: F2bL9LEHkt7jRA75ajJKtBxvLz9LsaWGFFBAz4CN4m5, call_on_revert: false, revert_message: [], on_revert_gas_limit: 0 }) Program log: Deposit and call executed with message = [100, 117, 115, 116, 32, 108, 97, 109, 112, 111, 114, 116, 115, 32, 115, 104, 111, 117, 108, 100, 32, 97, 98, 111, 114, 116, 32, 99, 99, 116, 120] Program 94U5AHQMKkV5txNJ17QPXWoh474PheGou6cNP2FEuL1d consumed 50037 of 99700 compute units Program 94U5AHQMKkV5txNJ17QPXWoh474PheGou6cNP2FEuL1d success]
solana       | [ERROR]
	Error Trace:	/go/delivery/zeta-node/e2e/e2etests/test_solana_deposit_and_call_revert_with_dust.go:53
	Error:      	Not equal:
	            	expected: 0
	            	actual  : 1000000

	            	Diff:
	            	--- Expected
	            	+++ Actual
	            	@@ -2,3 +2,4 @@
	            	  neg: (bool) false,
	            	- abs: (big.nat) {
	            	+ abs: (big.nat) (len=1) {
	            	+  (big.Word) 1000000
	            	  }

solana       | [ERROR]Failure: (*E2ERunner).FailNow for runner "solana". Exiting
setup        | ❌ solana tests failed: context cancelled in solana_deposit_and_call_revert_with_dust after 17.940023758s
setup        | ❌ e2e tests failed after 23.218043511s

So test failed as expected. We can use protocol's API to see errors reported with regards to abort processing:

Bash
❯ curl http://localhost:1317/zeta-chain/crosschain/inboundHashToCctxData/wApP7UV6QFnjUbHb7RWi6RbEEGmJFGG5TGdEAHQJc5Y3MXVm9zPCkXU43Uq9fPHKL41UKRATYobT7wscuWTtgBE | jq '.CrossChainTxs[0].cctx_status.error_message_abort'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3693    0  3693    0     0  1476k      0 --:--:-- --:--:-- --:--:-- 1803k
"failed to process abort: {\"type\":\"contract_call_error\",\"message\":\"contract call failed when calling EVM with data\",\"error\":\"execution reverted: ret 0x: evm transaction execution failed\",\"method\":\"executeAbort\",\"contract\":\"0x733aB8b06DDDEf27Eaa72294B0d7c9cEF7f12db9\",\"args\":\"[0x0000000011111111111111111111111111111111 {[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55] 0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb 900000 false 902 []}]\"}"

From this output it can be deduced that the target of the onAbort call was 0x0000000011111111111111111111111111111111, and not the actual address which was converted from EVM format to Solana format in the Go test.

Finally, to confirm that aborted funds ended up in the incorrect address, permanently lost:

Bash
❯ SOLZRC20=0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb
❯ ZETA="http://0.0.0.0:9545"
❯
❯ cast call -r $ZETA $SOLZRC20 "balanceOf(address) (uint256)" 0x0000000011111111111111111111111111111111
900000

Mitigation

Use EVM compatible format for specifiying the abort address in the Solana gateway

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/zeta-chain/protocol-contracts-solana/pull/110

gjaldon

The abort address format has been changed to a 20-element u8 array, which fixes the issue.

The original report as published on Sherlock, by Al-Qa-qa. 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

Root cause

The Solana gateway's RevertOptions struct defines abort_address as a Solana Pubkey instead of a 20-byte EVM address, causing an incorrect conversion when the abort is processed on ZetaChain.

Impact

Aborted funds are permanently lost because they are sent to an EVM address derived from the Solana public key, which the user does not control.

What the attacker needed

None

How it was found

  1. Modify the existing e2e test to convert a random EVM address to a Solana public key and use it as the abort address.
  2. Call deposit_and_call with the modified revert options.
  3. Run the test and observe that the abort processing fails and funds are sent to the derived EVM address.
  4. Check the balance of the derived EVM address to confirm it received the aborted funds.

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 a cross-chain transaction fails, the system tries to return the funds to an address the user specified. But on Solana, the code asked for a Solana-style address, while the refund actually happens on an Ethereum-style network. The system converted the Solana address into an Ethereum address that nobody controls, so the money was lost.

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 Al-Qa-qa

View all

7 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.