Skip to content

fix(abstract-eth): verify contractCall and customTx EVM TSS intents - #10203

Open
dpkjnr wants to merge 2 commits into
masterfrom
deepakjangid/cecho-2680-evm-tss-contractcall-customtx
Open

dpkjnr wants to merge 2 commits into
masterfrom
deepakjangid/cecho-2680-evm-tss-contractcall-customtx

Conversation

@dpkjnr

@dpkjnr dpkjnr commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Description

Hardens AbstractEthLikeNewCoins.verifyTssTransaction (modules/abstract-eth/src/abstractEthLikeNewCoins.ts) for contractCall, customTx, and their kebab-case aliases (contract-call, custom-tx), which previously returned true with only a warning and without inspecting to, value, or data.

Behavior implemented (match-and-validate)

  • 1 declared recipient: decodes txPrebuild.txHex and requires exact match on to, value (defaulting declared amount to '0' when omitted), and data (defaulting empty to '0x'). Any mismatch throws TxIntentMismatchRecipientError.
  • 0 recipients: fails closed with TxIntentMismatchRecipientError.
  • >1 recipients: fails closed with TxIntentMismatchRecipientError.
  • Kebab-case aliases: contract-call and custom-tx are exempted from the generic missing txParams guard so they reach the same fail-closed check as camelCase.
  • Non-EVM / shared guard unchanged: NO_RECIPIENT_TX_TYPES in @bitgo/sdk-core is untouched, so non-EVM coins (e.g. Solana/Aptos/Sui customTx, Provenance contractCall) are unaffected.
  • Test updates:
    • modules/sdk-coin-eth/test/unit/tssPaymentVerification.ts: replaced the pinned contractCall warning test with 26 regression tests covering all 4 spellings (matching call, mismatched destination/value/calldata, missing/empty recipients, >1 recipients, and default-0 value / empty calldata).
    • modules/sdk-coin-eth/test/unit/eth.ts: moved 7 TSS wrapper-approve tests from customTx (with 0 recipients) to tokenApproval so they keep exercising assertWrapperApproveIsDeclared.

Design reconciliation: match-and-validate vs. unapproved reject-all proposal

  • This PR implements the approved CECHO-2680 ticket description (match-and-validate against a single declared recipient; fail closed when unverifiable), which also aligns with INFOSEC-671's suggested fix and acceptance criteria.
  • A Nov 5 comment on CECHO-2680 proposed unconditionally rejecting contractCall / customTx on EVM TSS even when recipients are supplied, explicitly noting it was a proposal and did not change the ticket description. Because that scope change has not been approved, this PR does not silently adopt it. If reviewers prefer unconditional rejection, it is a small follow-up change in verifyTssContractCall.

Production compatibility, limits, and known gaps

  • Observed production data: Snowflake query over MARTS.WALLET_PLATFORM.BITGO2__TRANSACTION_REQUEST (INTENT + INTENTS[]) for Nov 5–19, 2026 shows 0 EVM contractCall/customTx requests (only Solana customTx, 125 distinct requests), consistent with the earlier full-history check.
  • Limits & external-client risk: Retained warehouse data is not proof about external SDK clients, test deployments, or client-side calls that never reached Wallet Platform. Any external EVM TSS caller passing contractCall/customTx with 0 recipients will now throw (breaking change for that shape).
  • Non-EIP-1559 EvmCoin bypass: Non-EIP-1559 chains routed through EvmCoin.verifyLegacyTssTransaction (e.g. legacy EvmCoin paths tracked in CECHO-2681 / CECHO-2683) are not protected by this PR.
  • Tempo: sdk-coin-tempo overrides verifyTransaction with its own verifier and is unaffected.
  • Scope / status boundaries: Sanket's Phase 1 verification is separate and pinned to BitGoJS v54.4.0. This PR does not claim INFOSEC-671 is closed or release-ready.

Issue Number

CECHO-2680 (related: INFOSEC-671, CECHO-2460)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (throws for EVM TSS contractCall/customTx with 0 or >1 recipients or mismatched to/value/data)

How Has This Been Tested?

  • INFOSEC-671 PoC repro script (against built dist on hbarevm):
    • Before fix: contractCall mismatch → true, customTx no recipients → true, contract-call mismatch → true, custom-tx empty recipients → true; transfer control threw.
    • After fix: 8/8 expectations met — all four vulnerable shapes throw TxIntentMismatchRecipientError; matching contractCall/customTx pass; 2-recipient case throws; transfer control throws.
  • Unit test suites (all passing):
    • @bitgo/sdk-coin-eth: 602 passing
    • @bitgo/abstract-eth: 188 passing
    • @bitgo/sdk-coin-evm: 40 passing
    • @bitgo/sdk-coin-bsc: 45 passing
    • @bitgo/sdk-coin-xdc: 65 passing
    • @bitgo/sdk-coin-flr: 61 passing
    • @bitgo/sdk-coin-ethlike: 55 passing
    • @bitgo/sdk-coin-polygon: 71 passing
    • @bitgo/sdk-core (test/unit/bitgo/utils/tss/recipientUtils.ts): 44 passing
  • Pre-existing unrelated failures observed: modules/bitgo/test/v2/unit/pendingApproval.ts had 32 passing / 3 failing (tbtc recreate + 2 keychains.ts TypeErrors); verified identical 3 failures on stashed unmodified origin/master.
  • Lint & format: eslint --quiet . and prettier --check clean on modules/abstract-eth and modules/sdk-coin-eth.

Verify contractCall, customTx, and their kebab-case aliases (contract-call,
custom-tx) in AbstractEthLikeNewCoins.verifyTssTransaction instead of
returning true unchecked.

Require exactly one declared recipient and compare decoded to, value
(default 0), and calldata against it, throwing TxIntentMismatchRecipientError
on any mismatch or when zero or multiple recipients are supplied. Exempt
the kebab-case aliases from the generic missing-txParams guard so they
reach the same fail-closed check. Leave NO_RECIPIENT_TX_TYPES and non-EVM
coins unchanged.

Ticket: CECHO-2680
Co-authored-by: Ralph CLI <ralph-cli@bitgo.com>
Ralph: 18.13.2-bitgo.13 openrouter/google/gemini-4-neon@default openrouter/z-ai/glm-5.3-flash@smol:low+commit:high+memory:low openrouter/anthropic/claude-opus-5.5@slow:high+plan:xhigh openrouter/openai/gpt-6.1-terra@vision:low+advisor:medium openrouter/deepseek/deepseek-v4.1-flash-1017@task:high openrouter/inclusionai/ling-3.1-flash@tiny:low openrouter/moonshotai/kimi-k3.1-pro@designer:high openrouter/google/gemini-3-pro-image@image web/exa@web openrouter/microsoft/mai-transcribe-2@dictation openrouter/typesafe/jev-1.14@judge
@dpkjnr
dpkjnr requested a review from a team as a code owner November 19, 2026 04:37

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

CECHO-2680

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Compatibility checks are failing on Node.js 27-nightly (experimental, non-blocking). This does not block merge, but it signals an incompatibility to fix before this release becomes supported.

View run

verifyTssContractCall decoded a TransactionBuilder round trip, which drops
calldata shorter than a selector and trailing bytes after recognised calls,
so the check could pass bytes that differ from what is signed. Decode the
serialized transaction directly. Restore coverage that a wrapper approve
relabelled as customTx is still rejected.

Ticket: CECHO-2680

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant