Zebra script: zebrad has consensus divergence via P2SH sigop undercount in pure-Rust disabled-opcode parser (CVE-2026-52735)
### 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.
AI Analysis
Technical Summary
The vulnerability arises from Zebra's P2SH sigop counter using a pure-Rust code path that short-circuits on disabled opcodes, returning a partial sigop count of zero for any sigops following the disabled opcode. In contrast, the reference implementation zcashd counts through disabled opcodes during static sigop analysis. This discrepancy leads to consensus divergence when the MAX_BLOCK_SIGOPS threshold (20,000) is crossed on one side but not the other. An attacker can exploit this by broadcasting transactions spending P2SH outputs with redeem scripts containing disabled opcodes followed by multiple OP_CHECKMULTISIG opcodes, causing Zebra to undercount sigops and accept blocks that zcashd rejects. The vulnerability affects all default configurations of zebrad up to v4.4.1 on any network shared with zcashd nodes. The issue is fixed in Zebra 4.4.2 by changing the P2SH sigop counting to use the C++ FFI path consistent with legacy sigop counting.
Potential Impact
This vulnerability can cause a chain split between Zebra and zcashd validators on networks where both participate. Zebra nodes may accept blocks containing transactions with malicious redeem scripts that zcashd nodes reject due to exceeding the sigop limit. Approximately 30% of the current network hashrate is estimated to be Zebra miners, so this can lead to significant network divergence. The attacker does not require mining capability or special privileges; only the ability to broadcast crafted transactions. The cost to the attacker is limited to transaction fees. This undermines network consensus and stability.
Mitigation Recommendations
A patch is available in Zebra version 4.4.2 that fixes the P2SH sigop counting to use the C++ FFI path consistent with the reference implementation. There is no configuration-level workaround. Operators should upgrade to Zebra 4.4.2 or later as soon as possible to prevent chain splits and consensus divergence.
Zebra script: zebrad has consensus divergence via P2SH sigop undercount in pure-Rust disabled-opcode parser (CVE-2026-52735)
Description
### 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.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises from Zebra's P2SH sigop counter using a pure-Rust code path that short-circuits on disabled opcodes, returning a partial sigop count of zero for any sigops following the disabled opcode. In contrast, the reference implementation zcashd counts through disabled opcodes during static sigop analysis. This discrepancy leads to consensus divergence when the MAX_BLOCK_SIGOPS threshold (20,000) is crossed on one side but not the other. An attacker can exploit this by broadcasting transactions spending P2SH outputs with redeem scripts containing disabled opcodes followed by multiple OP_CHECKMULTISIG opcodes, causing Zebra to undercount sigops and accept blocks that zcashd rejects. The vulnerability affects all default configurations of zebrad up to v4.4.1 on any network shared with zcashd nodes. The issue is fixed in Zebra 4.4.2 by changing the P2SH sigop counting to use the C++ FFI path consistent with legacy sigop counting.
Potential Impact
This vulnerability can cause a chain split between Zebra and zcashd validators on networks where both participate. Zebra nodes may accept blocks containing transactions with malicious redeem scripts that zcashd nodes reject due to exceeding the sigop limit. Approximately 30% of the current network hashrate is estimated to be Zebra miners, so this can lead to significant network divergence. The attacker does not require mining capability or special privileges; only the ability to broadcast crafted transactions. The cost to the attacker is limited to transaction fees. This undermines network consensus and stability.
Mitigation Recommendations
A patch is available in Zebra version 4.4.2 that fixes the P2SH sigop counting to use the C++ FFI path consistent with the reference implementation. There is no configuration-level workaround. Operators should upgrade to Zebra 4.4.2 or later as soon as possible to prevent chain splits and consensus divergence.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-gf9r-m956-97qx
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-52735"]
- Ecosystems
- ["crates.io"]
- Database Specific Severity
- CRITICAL
- Cvss Version
- 4.0
Threat ID: 6a46ecb627e9c7971943c9b1
Added to database: 07/02/2026, 22:56:54 UTC
Last enriched: 07/02/2026, 23:11:23 UTC
Last updated: 07/31/2026, 12:27:30 UTC
Views: 57
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.