Skip to content

fix(sdk-coin-eth): strictly verify the multisig enable-token sendMultiSig operation (CECHO-2815) - #10200

Merged
nvrakesh06 merged 1 commit into
masterfrom
nvrakeshreddy/cecho-2815-bitgojs-multisig-enable-token-path
Nov 23, 2026
Merged

nvrakesh06 merged 1 commit into
masterfrom
nvrakeshreddy/cecho-2815-bitgojs-multisig-enable-token-path

Conversation

@nvrakesh06

@nvrakesh06 nvrakesh06 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes the client-side verification gap from CECHO-2815: the multisig branch of Erc7984Token.verifyEnableTokenTransaction validated only txPrebuild.buildParams.recipients — client-attached echo data that Wallet.buildTokenEnablements builds from the caller's own enableTokens — so the operation the user actually signs was never inspected.

What actually gets signed (the fix's binding target): onchain-multisig users sign the sendMultiSig operation hash over txPrebuild.recipients[0] (address, amount, data) — never over txHex (Eth.signTransaction → getOperationSha3ForExecuteAndConfirm hashes the platform-supplied recipient verbatim; halfSigned carries no txHex), and the MultiSigV3 contract enforces at execution that the broadcast args hash to that op. So recipients[0] is the single authoritative binding, and the strict flow verifies it in full:

  1. Value — the signed sendMultiSig native value must be 0 (blocks direct native-fund theft).
  2. Calldata — the signed data must decode fail-closed as a delegation calldata (decodeDelegationCallsFromCalldata, CECHO-2720): rejects any other selector (e.g. an ERC-20 approve(attacker, …) theft prebuild) and any smuggled non-delegation inner call.
  3. Target — aclMulticall shape must target the ACL contract; the callFromParent (forwarder) shape is bound on-chain by the forwarder's onlyParent modifier plus the enforced callFromParent target/value — same decision as the TSS path.
  4. Delegation content — verifyStrictEnableTokenCalldata (CECHO-2720 helper, unchanged) binds delegate == pinned enterprise viewing key (fail closed when unpinned), future expiry, and an exact deduplicated match against the requested tokens.
  5. txHex mirror (defense in depth) — when the prebuild carries a txHex, its sendMultiSig args must mirror the recipient exactly: a diverging (decoy) txHex that passes verification while different args get signed is rejected.

Gate — non-breaking by construction: Flipt flag multisig-enable-token-strict-verification, delivered by the platform as the typed prebuild field TransactionPrebuild.multisigEnableTokenStrictVerification. The legacy flow is the default: absent or false keeps it; only an explicit true enables the strict flow. Consequently this PR changes nothing for any deployment until the platform opts in — when the version is bumped into Wallet Platform before the platform-side change lands, prebuilds carry no field and behavior is byte-for-byte the pre-fix flow. The contract is declared once in the type system (compiler-checked on both ends, no prototype-chain or narrowing tricks), purpose-scoped to this one check — there is no generic flag map on SDK types, and any future flag needs its own reviewed field.

Sequencing:

  1. This PR merges and is bumped into WP — inert: legacy flow everywhere, no behavior change, no prerequisites.
  2. Platform-side follow-up (tracked in the ticket): define the Flipt flag (default true, no customer-controllable segments), evaluate it, and stamp multisigEnableTokenStrictVerification: true on ERC-7984 enable-token prebuilds → strict activates everywhere; flipping the Flipt flag to false (or dropping the stamp) is the runtime kill switch, per request, no SDK redeploy.
  3. Prerequisites attached to step 2, not this merge: zamaViewingKeyAddress pins for mainnet + Hoodi in BitGoJS statics (strict fails closed without them), and staging validation of real prebuild shapes (recipients[0].data presence, ACL target shapes).

Until step 2 ships, the SDK behaves as the legacy flow and the ticket's vulnerability remains open in the field — activation is the platform change.

Issue Number

CECHO-2815 (related: CECHO-2720, CECHO-2719)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Unit tests — 14 multisig strict-path cases in modules/sdk-coin-eth/test/unit/erc7984Token.ts:

  • benign base-wallet enable (aclMulticall shape) passes when the platform enables the flag
  • benign forwarder enable (callFromParent shape) passes
  • benign enable with a mirroring txHex passes
  • non-zero sendMultiSig value rejected (native fund theft)
  • ERC-20 approve theft prebuild rejected (non-delegation calldata)
  • delegate substitution to an attacker viewing key rejected
  • smuggled non-delegation inner call rejected
  • aclMulticall shape targeted away from the ACL contract rejected
  • callFromParent theft shape (forwarder → attacker contract with funds) rejected
  • decoy txHex whose sendMultiSig args differ from the signed recipient rejected
  • txHex that is not a sendMultiSig envelope rejected
  • prebuild with no recipient (nothing to bind the signature to) rejected
  • legacy-default proof (bump safety): with the flag absent — the exact prebuild shape the SDK sees before the platform-side change — a fully hostile prebuild passes on the legacy flow
  • kill-switch proof: an explicit flag false keeps the legacy flow

The five legacy-path tests run with no flag on the prebuild (the default shape).

Full-module runs: modules/sdk-coin-eth 592 passing, modules/abstract-eth 188 passing — zero failures. Reproduce: cd modules/sdk-coin-eth && npx mocha.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My code compiles correctly for both Node and Browser environments
  • I have commented my code, particularly in hard-to-understand areas
  • My commits follow Conventional Commits and I have properly described any BREAKING CHANGES
  • The ticket or github issue was included in the commit message as a reference
  • I have made corresponding changes to the documentation and on any new/updated functions and/or methods - jsdoc
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

@linear-code

linear-code Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

CECHO-2815

@github-actions

github-actions Bot commented Nov 18, 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

@nvrakesh06
nvrakesh06 force-pushed the nvrakeshreddy/cecho-2815-bitgojs-multisig-enable-token-path branch 7 times, most recently from 090dd9a to 971d3df Compare November 19, 2026 12:34
…iSig operation (CECHO-2815)

The multisig branch of Erc7984Token.verifyEnableTokenTransaction compared only
txPrebuild.buildParams.recipients — client-attached echo data built by
Wallet.buildTokenEnablements from the caller's own enableTokens — so the operation
the user actually signs was never inspected. Onchain-multisig users sign the
sendMultiSig operation hash over txPrebuild.recipients[0] (address, amount, data),
never over txHex, and the MultiSigV3 contract enforces at execution that the
broadcast args hash to that op: a compromised platform could serve any recipient
(attacker contract with native value, ERC-20 approve theft, or a delegate
substitution) and the user would first-sign it.

Strict flow: bind the signed recipient in full —
  1. sendMultiSig native value must be 0;
  2. the recipient data must decode fail-closed as a delegation calldata
     (rejects approve/transfer and smuggled inner calls);
  3. aclMulticall shape must target the ACL contract (the forwarder shape is
     bound on-chain by onlyParent plus the enforced callFromParent target/value);
  4. verifyStrictEnableTokenCalldata binds delegate == pinned enterprise viewing
     key, future expiry, and an exact deduplicated match against the requested
     tokens (CECHO-2720 helper, unchanged);
  5. when the prebuild carries a txHex, its sendMultiSig args must mirror the
     recipient — a diverging (decoy) txHex is rejected.

Gate — non-breaking by construction: Flipt flag
multisig-enable-token-strict-verification, delivered by the platform as the
typed prebuild field multisigEnableTokenStrictVerification. The legacy flow is
the default: absent or false keeps it; only an explicit true enables the strict
flow. Bumping this SDK into any deployment before the platform stamps the field
is therefore a no-op — behavior is byte-for-byte the pre-fix flow. Activation
(stamping true by default) is the platform-side follow-up; flipping the Flipt
flag to false is the runtime kill switch once active. Purpose-scoped: one
declared field for this one check, no generic flag map on SDK types.

Tests: 14 multisig strict-path cases — benign both delegation shapes (flag
enabled by the platform), txHex mirror pass, value theft, approve theft,
delegate substitution, smuggled inner call, wrong ACL target, callFromParent
theft shape, decoy txHex, non-sendMultiSig txHex, missing recipient, and the
legacy-default proofs: an absent flag and an explicit false both keep a fully
hostile prebuild verifying on the legacy flow (bump-safety and kill-switch).
The five legacy-path tests run with no flag on the prebuild — the exact shape
the SDK sees before the platform-side change. sdk-coin-eth 592 passing,
abstract-eth 188 passing.
@nvrakesh06
nvrakesh06 force-pushed the nvrakeshreddy/cecho-2815-bitgojs-multisig-enable-token-path branch from 971d3df to 9113b40 Compare November 23, 2026 05:44
@nvrakesh06
nvrakesh06 marked this pull request as ready for review November 23, 2026 05:53
@nvrakesh06
nvrakesh06 requested a review from a team as a code owner November 23, 2026 05:53

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

@nvrakesh06
nvrakesh06 merged commit fa64057 into master Nov 23, 2026
27 checks passed
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.

2 participants