CVE-2026-52735: Zebra script Zebrad Has Consensus Divergence Vulnerability

CRITICAL
Advisory Identifier: GHSA-gf9r-m956-97qx
CWE-684
Published
Advisory Summary

CVE-2026-52735 is a CRITICAL zebrad has consensus divergence vulnerability (CWE-684: Incorrect Provision of Specified Functionality) affecting Zebra script libraries in the crates.io ecosystem. The issue involves zebrad has consensus divergence via p2sh sigop undercount in pure-rust disabled-opcode parser. Remediation is available by upgrading affected packages to version 7.0.0, 4.5.0.

CVE-2026-52735 at a Glance

CVE Identifier CVE-2026-52735
GHSA Identifier GHSA-gf9r-m956-97qx
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-684: Incorrect Provision of Specified Functionality
Affected Product Zebra script
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix CVE-2026-52735

To remediate this vulnerability, upgrade all affected Zebra script dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

zebra-script fixed: 7.0.0
Upgrade zebra-script to 7.0.0
zebrad fixed: 4.5.0
Upgrade zebrad to 4.5.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for zebra-script

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-52735, inspect your project dependencies for Zebra script:

inspect dependencies for zebra-script

Analyze the terminal output to locate any version of Zebra script in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.0.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-684: Incorrect Provision of Specified Functionality, where the code does not function according to its published specifications, potentially leading to incorrect usage. In Zebra script, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Am I affected You are affected if: 1. You run any version of `zebrad` up to and including `v4.4.1`. 2. Your node validates blocks on mainnet, testnet, or any network where both Zebra and zcashd nodes participate. All default configurations are affected. No feature flags, non-default settings, or special build options are required. ### Summary Zebra's P2SH sigop counter uses a pure-Rust code path that short-circuits on disabled opcodes (such as `OP_CODESEPARATOR`), returning a partial count of zero for any sigops following the disabled opcode. The reference implementation (zcashd) correctly counts through disabled opcodes in its static sigop analysis. This produces a consensus divergence: Zebra accepts blocks that zcashd rejects when the block-wide `MAX_BLOCK_SIGOPS = 20,000` threshold is crossed on one side but not the other. An attacker can exploit this without mining capability. Broadcasting transactions that spend P2SH outputs with malicious redeem scripts is sufficient; any Zebra miner who includes those transactions in a block triggers a chain split between Zebra and zcashd validators. ### Details The P2SH sigop counter at `zebra-script/src/lib.rs:399` calls `script::Code(redeemed_bytes).sig_op_count(true)`, which is a pure-Rust path through `zcash_script-0.4.4`. The legacy (non-P2SH) sigop counter at `lib.rs:282-289` correctly uses the C++ FFI via `interpreter.legacy_sigop_count_script()`. Only the P2SH path bypasses the FFI. The Rust parser in `zcash_script-0.4.4/src/opcode/mod.rs:1247-1260` treats 16 disabled opcodes (0x7e through 0xab, including `OP_CAT`, `OP_SUBSTR`, `OP_AND`, `OP_OR`, `OP_XOR`, `OP_2MUL`, `OP_2DIV`, `OP_MUL`, `OP_DIV`, `OP_MOD`, `OP_LSHIFT`, `OP_RSHIFT`, and `OP_CODESEPARATOR`) as `Err(Error::Disabled(...))`. The `sig_op_count` function at `iter.rs:104-115` uses `try_fold`, which terminates on the first `Err` and returns the partial sum accumulated so far. zcashd's `GetOp2` (`script.h:514-562`) returns `true` for all non-push opcodes including the disabled range. Its `GetSigOpCount(true)` (`script.cpp:152-174`) continues counting through disabled opcodes. zcashd rejects disabled opcodes at execution time in the interpreter, not during static sigop analysis. A redeem script of `[0xab, OP_CHECKMULTISIG x 50]` produces: Zebra = 0 sigops, zcashd = 1,000 sigops. Across 21 inputs in a block, Zebra computes 0 while zcashd computes 21,000, crossing the `MAX_BLOCK_SIGOPS = 20,000` threshold on one side only. ### Patches Patched in Zebra 4.4.2. The fix routes the P2SH sigop counter through the same C++ FFI already used by the legacy sigop counter. ### Workarounds There is no configuration-level workaround. All Zebra nodes validating blocks on a network shared with zcashd are affected. Upgrade as soon as the patched version is available. ### Impact A chain split between Zebra and zcashd validators. The attacker broadcasts spending transactions referencing P2SH outputs whose redeem scripts contain a disabled opcode followed by `OP_CHECKSIG` or `OP_CHECKMULTISIG` opcodes. When a Zebra miner (estimated ~30% of current network hashrate) includes these transactions in a block, Zebra validators accept the block while zcashd validators reject it with `bad-blk-sigops`. The two halves of the network diverge and every subsequent block extending the Zebra-side tip inherits the divergence. The attacker does not need mining capability, RPC access, or any special privileges. The cost is the transaction fees for the funding and spending transactions. ### Credit Reported by `@samsulselfut` via a private GitHub Security Advisory submission.

CVE-2026-52735 Affected Zebra script Versions

2 component(s)
Fixed Versions:
7.0.04.5.0
Product / Package Ecosystem Affected Versions Fixed Version
zebra-script
crates.io
< 7.0.0
7.0.0
zebrad
crates.io
< 4.5.0
4.5.0

References

Frequently Asked Questions

What is CVE-2026-52735?
CVE-2026-52735 is a security vulnerability in Zebra script involving zebrad has consensus divergence via P2SH sigop undercount in pure-Rust disabled-opcode parser under CWE-684: Incorrect Provision of Specified Functionality.
Which Zebra script versions are affected?
Affected versions include releases prior to 7.0.0, 4.5.0 across affected packages: zebra-script, zebrad.
What version fixes CVE-2026-52735?
Upgrading to 7.0.0, 4.5.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is zebra-script affected?
Yes, zebra-script is affected in releases prior to 7.0.0. Upgrade your dependency to 7.0.0 or later.
Is zebrad affected?
Yes, zebrad is affected in releases prior to 4.5.0. Upgrade your dependency to 4.5.0 or later.
What CWE is associated with CVE-2026-52735?
CVE-2026-52735 is classified under CWE-684: Incorrect Provision of Specified Functionality (The code does not function according to its published specifications, potentially leading to incorrect usage.).
How can I check crates.io dependencies for CVE-2026-52735?
Run the dependency tree command: 'inspect dependencies for zebra-script'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gf9r-m956-97qx",
  "modified" : "2026-07-02T19:43:36Z",
  "published" : "2026-07-02T19:43:36Z",
  "aliases" : [ "CVE-2026-52735" ],
  "summary" : "zebrad has consensus divergence via P2SH sigop undercount in pure-Rust disabled-opcode parser",
  "details" : "### Am I affected\n\nYou are affected if:\n\n1. You run any version of `zebrad` up to and including `v4.4.1`.\n2. Your node validates blocks on mainnet, testnet, or any network where both Zebra and zcashd nodes participate.\n\nAll default configurations are affected. No feature flags, non-default settings, or special build options are required.\n\n### Summary\n\nZebra's P2SH sigop counter uses a pure-Rust code path that short-circuits on disabled opcodes (such as `OP_CODESEPARATOR`), returning a partial count of zero for any sigops following the disabled opcode. The reference implementation (zcashd) correctly counts through disabled opcodes in its static sigop analysis. This produces a consensus divergence: Zebra accepts blocks that zcashd rejects when the block-wide `MAX_BLOCK_SIGOPS = 20,000` threshold is crossed on one side but not the other.\n\nAn attacker can exploit this without mining capability. Broadcasting transactions that spend P2SH outputs with malicious redeem scripts is sufficient; any Zebra miner who includes those transactions in a block triggers a chain split between Zebra and zcashd validators.\n\n### Details\n\nThe P2SH sigop counter at `zebra-script/src/lib.rs:399` calls `script::Code(redeemed_bytes).sig_op_count(true)`, which is a pure-Rust path through `zcash_script-0.4.4`. The legacy (non-P2SH) sigop counter at `lib.rs:282-289` correctly uses the C++ FFI via `interpreter.legacy_sigop_count_script()`. Only the P2SH path bypasses the FFI.\n\nThe Rust parser in `zcash_script-0.4.4/src/opcode/mod.rs:1247-1260` treats 16 disabled opcodes (0x7e through 0xab, including `OP_CAT`, `OP_SUBSTR`, `OP_AND`, `OP_OR`, `OP_XOR`, `OP_2MUL`, `OP_2DIV`, `OP_MUL`, `OP_DIV`, `OP_MOD`, `OP_LSHIFT`, `OP_RSHIFT`, and `OP_CODESEPARATOR`) as `Err(Error::Disabled(...))`. The `sig_op_count` function at `iter.rs:104-115` uses `try_fold`, which terminates on the first `Err` and returns the partial sum accumulated so far.\n\nzcashd's `GetOp2` (`script.h:514-562`) returns `true` for all non-push opcodes including the disabled range. Its `GetSigOpCount(true)` (`script.cpp:152-174`) continues counting through disabled opcodes. zcashd rejects disabled opcodes at execution time in the interpreter, not during static sigop analysis.\n\nA redeem script of `[0xab, OP_CHECKMULTISIG x 50]` produces: Zebra = 0 sigops, zcashd = 1,000 sigops. Across 21 inputs in a block, Zebra computes 0 while zcashd computes 21,000, crossing the `MAX_BLOCK_SIGOPS = 20,000` threshold on one side only.\n\n### Patches\n\nPatched in Zebra 4.4.2. The fix routes the P2SH sigop counter through the same C++ FFI already used by the legacy sigop counter.\n\n### Workarounds\n\nThere is no configuration-level workaround. All Zebra nodes validating blocks on a network shared with zcashd are affected. Upgrade as soon as the patched version is available.\n\n### Impact\n\nA chain split between Zebra and zcashd validators. The attacker broadcasts spending transactions referencing P2SH outputs whose redeem scripts contain a disabled opcode followed by `OP_CHECKSIG` or `OP_CHECKMULTISIG` opcodes. When a Zebra miner (estimated ~30% of current network hashrate) includes these transactions in a block, Zebra validators accept the block while zcashd validators reject it with `bad-blk-sigops`. The two halves of the network diverge and every subsequent block extending the Zebra-side tip inherits the divergence.\n\nThe attacker does not need mining capability, RPC access, or any special privileges. The cost is the transaction fees for the funding and spending transactions.\n\n### Credit\n\nReported by `@samsulselfut` via a private GitHub Security Advisory submission.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zebra-script"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.0.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.0.1"
    }
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zebrad"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.5.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.4.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ZcashFoundation/zebra/security/advisories/GHSA-gf9r-m956-97qx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/AlfredoG87/zcash_script/blob/v0.4.4/src/script/iter.rs#L104-L115"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ZcashFoundation/zebra"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ZcashFoundation/zebra/blob/d4cd662c716382f6397d2a730148025a1ca79fec/zebra-consensus/src/block.rs#L140"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ZcashFoundation/zebra/blob/d4cd662c716382f6397d2a730148025a1ca79fec/zebra-script/src/lib.rs#L383-L400"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-684" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-02T19:43:36Z",
    "nvd_published_at" : null
  }
}