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.
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
- A malicious user sends a message with very low value, e.g., 0.001 TON. Set the
forward_feeorfee_remainingso that only a tiny gas budget is passed. The message will have a valid message body for a deposit operation. - TON VM will then skip execution and record
compute.skipped = truefor the message sent to the Gateway contract. - The TON Observer will get every transaction and parse it.
- 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.
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
- Send a message with very low value and a valid deposit body so only a tiny gas budget is passed.
- The TON VM skips execution and records the compute phase as skipped.
- The TON Observer fetches every transaction and parses it.
- 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.