{"schema":"threatline.record/2","record":{"id":"CVE-2026-52735","aliases":["GHSA-gf9r-m956-97qx"],"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.","categories":["Libraries & packages"],"product":"zebra-script","vendor":"ZcashFoundation","ecosystem":"rust","affected_ranges":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-gf9r-m956-97qx","source_modified_at":"2026-09-30T22:55:26Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"rust","name":"zebra-script"},"range":"<= 6.0.1"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-gf9r-m956-97qx","source_modified_at":"2026-09-30T22:55:26Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"rust","name":"zebrad"},"range":"<= 4.4.1"},{"source":"CVE List","source_url":"https://www.cve.org/CVERecord?id=CVE-2026-52735","source_modified_at":"2026-08-18T19:48:45.150Z","fetched_at":"2026-10-23T18:45:31.882637Z","product":"zebra","vendor":"ZcashFoundation","versions":[{"version":"< 4.5.0","status":"affected"}],"defaultStatus":null},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-gf9r-m956-97qx","source_modified_at":"2026-07-02T20:11:29.482145Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"zebra-script","ecosystem":"crates.io","purl":"pkg:cargo/zebra-script"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"7.0.0"}]}],"versions":[]},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-gf9r-m956-97qx","source_modified_at":"2026-07-02T20:11:29.482145Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"zebrad","ecosystem":"crates.io","purl":"pkg:cargo/zebrad"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"4.5.0"}]}],"versions":[]}],"fixed_versions":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-gf9r-m956-97qx","source_modified_at":"2026-09-30T22:55:26Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"rust","name":"zebra-script"},"version":"7.0.0"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-gf9r-m956-97qx","source_modified_at":"2026-09-30T22:55:26Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"rust","name":"zebrad"},"version":"4.5.0"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-gf9r-m956-97qx","source_modified_at":"2026-07-02T20:11:29.482145Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"zebra-script","ecosystem":"crates.io","purl":"pkg:cargo/zebra-script"},"version":"7.0.0"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-gf9r-m956-97qx","source_modified_at":"2026-07-02T20:11:29.482145Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"zebrad","ecosystem":"crates.io","purl":"pkg:cargo/zebrad"},"version":"4.5.0"}],"cvss":9.3,"severity":"Critical","kev":{"listed":false},"epss":{"probability":0.00507,"percentile":0.42371,"score_date":"2026-10-23"},"published_at":"2026-08-18T19:23:10.705Z","modified_at":"2026-09-30T22:55:26Z","provenance":[{"source":"GitHub Advisory Database","url":"https://github.com/advisories/GHSA-gf9r-m956-97qx","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-09-30T22:55:26Z"},{"source":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2026-52735","fetched_at":"2026-10-23T18:45:31.882637Z","source_modified_at":"2026-08-18T19:48:45.150Z"},{"source":"OSV","url":"https://osv.dev/vulnerability/GHSA-gf9r-m956-97qx","fetched_at":"2026-10-23T18:45:31.882637Z","source_modified_at":"2026-07-02T20:11:29.482145Z"},{"source":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-52735","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-10-23"}],"sources":["GitHub Advisory Database","CVE List","OSV","EPSS"],"references":[{"source":"CVE List","url":"https://github.com/ZcashFoundation/zebra/security/advisories/GHSA-gf9r-m956-97qx","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/AlfredoG87/zcash_script/blob/v0.4.4/src/script/iter.rs#L104-L115","source":"GitHub Advisory Database"},{"url":"https://github.com/ZcashFoundation/zebra/blob/d4cd662c716382f6397d2a730148025a1ca79fec/zebra-consensus/src/block.rs#L140","source":"GitHub Advisory Database"},{"url":"https://github.com/ZcashFoundation/zebra/blob/d4cd662c716382f6397d2a730148025a1ca79fec/zebra-script/src/lib.rs#L383-L400","source":"GitHub Advisory Database"},{"url":"https://github.com/advisories/GHSA-gf9r-m956-97qx","source":"GitHub Advisory Database"},{"source":"CVE List","url":"https://github.com/ZcashFoundation/zebra/commit/1440b43ca7df59aca948090d45117557b217a6cd","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/ZcashFoundation/zebra/releases/tag/v4.5.0","tags":["x_refsource_MISC"]}],"locations":[],"motoko_assessment":{"status":"requires_architecture_review","automatic_remediation":false},"cve_state":"PUBLISHED","ssvc":{"exploitation":"none","automatable":"yes","technical_impact":"partial","assessed_at":"2026-08-18T19:48:36.850142Z"},"classification":{"method":"product-first software-layer rules","rules_version":"2.1","matched_on":"ecosystem","confidence":"heuristic","reviewed":false},"change_timestamp":"2026-09-30T22:55:26Z","content_hash":"78a0c776abd26436bf43c52329697ebeaf55911975e7aa702f311217f98de8a1"}}
