Skip to content

Sui inbound observer rejects valid Gateway events with EventIndex != 0 and advances cursor past them #4584

Open

Description

@kingpinXD

Summary

The Sui inbound observer rejects any Gateway event with EventIndex != 0 and the scanner cursor advances past the rejected event. On Sui, a single Programmable Transaction Block (PTB) can call the Gateway deposit / depositAndCall functions multiple times, generating Gateway events at EventSeq = 0, 1, …. Today only the first event is processed; later valid events in the same transaction are permanently skipped, leaving the user's funds in the Sui Gateway vault with no corresponding CCTX on ZetaChain.

Code

zetaclient/chains/sui/observer/inbound.go:172-176

case event.EventIndex != 0:
    // Is it possible to have multiple events per tx?
    // e.g. contract "A" calls Gateway multiple times in a single tx (deposit to multiple accounts)
    // most likely not, so let's explicitly fail to prevent undefined behavior.
    return errors.Errorf("unexpected event index %d for tx %s", event.EventIndex, event.TxHash)

zetaclient/chains/sui/observer/inbound.go:73-102 — the cursor advancement loop only halts on errTxNotFound and errVoteInbound. Any other error (including the EventIndex != 0 rejection above) falls through to setCursor, so the rejected event's slot is recorded and never revisited. Tracker recovery calls the same processInboundEvent path, so manual recovery hits the same gate.

pkg/contracts/sui/gateway.go:318 — EventIndex is parsed from event.Id.EventSeq, so the parser already supports non-zero indices.

Reproduction

A user submits a Sui PTB calling both gateway::deposit<SUI> and gateway::deposit_and_call<SUI> in a single transaction. The Sui transaction succeeds and emits two Gateway events at eventSeq=0 and eventSeq=1. ZetaChain's observer processes the first event normally, rejects the second with "unexpected event index 1", and advances the cursor to <tx>,1. A later scanner pass does not replay the skipped event, and MsgAddInboundTracker cannot recover it because the tracker path also routes through processInboundEvent.

ZCNode-252 includes a working local Sui validator reproduction confirming the multi-event PTB shape.

Fix direction

Either of the following resolves it; the first is preferred:

  • Remove the EventIndex != 0 rejection and process each Gateway event independently. The vote message already carries EventIndex, so each event maps to its own ballot.
  • Alternatively, mirror the EVM observer's "first event per transaction" filter rather than a hard failure, and do not advance the cursor past valid events that were not voted on.

In either case, the cursor must not advance past a Gateway event that did not result in an inbound vote.

HackenProof reports

Activity

  1. added
    zetaclient
    security
    on May 4, 2026
  2. roopd3v commented on May 29, 2026

    @roopd3v

    I am the researcher who found and reported this bug.

    And after ZetaChain used my report to fix the vulnerability, the program manager downgraded it to Low ( = 0$ ) with this ridiculous explanation:

    @Tanmay12312
    manager
    May 26, 2026 05:19am
    Thanks for bringing this up
    The issue has been fixed, and the fix was applied after your investigation; therefore, this report has proved useful.
    
    However that attack itself has no benift for the attacker , I would classify this as low”
    

    So let me make this very clear for every researcher reading this.

    ZetaChain accepted that the issue was real.
    ZetaChain opened a public GitHub security issue for it.
    ZetaChain referenced the HackenProof reports, including ZCNode-243.
    ZetaChain fixed the exact bug.
    ZetaChain added tests for the exact scenario.
    And only when it came time to pay, the impact suddenly became “Low” just because low severity means 0$ payment.

    That is shameful.

    The public GitHub issue says the Sui inbound observer rejected valid Gateway events with EventIndex != 0, advanced the scanner cursor past the rejected event and could leave user funds in the Sui Gateway vault with no corresponding CCTX on ZetaChain.

    The public fix PR is literally titled:

    “fix(sui): process multiple gateway events per tx”

    The PR says it allows the Sui inbound observer to process Gateway events with non-zero event indexes and keeps each Gateway event mapped to its own inbound vote.

    So do not insult researchers by pretending this was some worthless Low issue.

    If the bug was useful enough to create a public security issue, useful enough to reference my report, useful enough to fix in the core node and useful enough to add regression tests for, then it was useful enough to pay for!

    “The attacker has no benefit” is a shameful excuse.

    Security impact is not only attacker profit. A bug can harm users, break protocol execution, cause stuck funds, skip valid deposits, break cross-chain flows and still be a valid bounty issue.

    This bug caused exactly that:

    • a valid Sui Gateway event could be skipped;
    • the observer could reject the later event;
    • the cursor could advance past it;
    • no inbound vote would be created;
    • no CCTX would be created;
    • the user’s cross-chain action could remain stuck.

    Calling that Low after using the report and applying the fix is not honest triage. It is free security labor exploitation.

    This is the kind of behavior that makes researchers stop reporting bugs.

    If ZetaChain wants to run a bug bounty program, then act like it. Do not use researchers’ work to fix your software and then hide behind a nonsense downgrade to avoid paying.

    Have some shame!!!

    Other researchers should see this before spending time helping this program. If a valid report can be accepted, used, publicly fixed, referenced in GitHub and then downgraded below the payment threshold with this kind of excuse, then people deserve to know exactly how this was handled.

    White hats/Researchers: don't waste your time on this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securityzetaclient

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions