Skip to content
DoS Audit finding Intermediate

TON Gateway transactions with a skipped compute phase will cause a panic

The TON Gateway parser assumes every transaction has a compute phase, but a message sent with too little gas causes the compute phase to be skipped. A malicious user could send such a message, making the TON Observer panic and stop processing inbound deposits.

0x73696d616f Follow with g

Originally disclosed on Sherlock

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

Found by

0x73696d616f, g

Summary

There are cases when a transaction for the Gateway will skip the compute phase. When this happens, exitCodeFromTx() will panic because TrPhaseComputeVm will be nil.

Root Cause

exitCodeFromTx() assumes that TrPhaseComputeVm is always present. However, that is false because ComputePh is a Sum type with two variants.

GOLANG
type TrComputePhase struct {
	SumType
	TrPhaseComputeSkipped struct {
		Reason ComputeSkipReason
	} `tlbSumType:"tr_phase_compute_skipped$0"`
	TrPhaseComputeVm struct {
                     // ... snip ...
		} `tlb:"^"`
	} `tlbSumType:"tr_phase_compute_vm$1"`
}

A transaction can skip the compute phase when the message sent to the Gateway contract provides less gas than is required for minimal execution. The minimum amount of gas needed is implementation-dependent, but roughly in the ~10⁵ nanoton (0.1 TON) range for basic contracts.

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

  1. A malicious user sends a message with very low value, e.g., 0.001 TON. Set the forward_fee or fee_remaining so that only a tiny gas budget is passed. The message will have a valid message body for a deposit operation.
  2. TON VM will then skip execution and record compute.skipped = true for the message sent to the Gateway contract.
  3. The TON Observer will get every transaction and parse it.
  4. When parsing the Inbound Deposit that skipped the compute phase, it will panic when calling exitCodeFromTx().

Impact

All TON Observers' ObserveInbound and ProcessInboundTrackers go-routines will crash and no longer process any inbound deposits to the TON Gateway.

PoC

No response

Mitigation

Consider adding a check to ensure the compute phase is present before accessing the TrPhaseComputeVm field.

The original report as published on Sherlock, by 0x73696d616f. 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 parser assumes the compute phase is always present, but the compute phase is a sum type that can be the 'skipped' variant instead.

Impact

All TON Observers' ObserveInbound and ProcessInboundTrackers goroutines will crash and no longer process any inbound deposits to the TON Gateway.

What the attacker needed

Ability to send a TON message to the Gateway; message with very low gas budget

The fix

The parser should check that the compute phase is present before accessing the TrPhaseComputeVm field.

How it was found

  1. Send a message with very low value and a valid deposit body so only a tiny gas budget is passed.
  2. The TON VM skips execution and records the compute phase as skipped.
  3. The TON Observer fetches every transaction and parses it.
  4. Parsing the inbound deposit that skipped the compute phase panics in exitCodeFromTx().

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 blockchain observer is a program that watches transactions and reports them to another system. Here the observer assumed every transaction ran its code, but a transaction can be set up so the code is skipped, and the observer then crashes when it tries to read a result that does not exist.

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 0x73696d616f

View all

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

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.