6.5medium
ZEBRA: Persistent on-disk corruption of Sapling/Orchard subtree roots after chain fork via pop_tip
- Severity
- 6.5medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.34% (higher than 28% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-2gf8-q9rr-jq3h
Description
ZEBRA is a Zcash node written entirely in Rust. Prior to 4.5.0, a natural or attacker-influenced chain fork can leave stale Sapling and Orchard note-commitment subtree roots in Zebra state. In zebra-state/src/service/non_finalized_state/chain.rs, Chain::pop_tip removed a reverted tip block but did not remove subtree entries whose end_height belonged to that block, unlike the cleanup performed by pop_root. When the winning fork later finalized, the abandoned branch's stale subtree data could be written to RocksDB and survive node restarts. The corrupted history can cause z_getsubtreesbyindex consumers such as lightwalletd and light wallets to receive incorrect subtree roots, producing wallet synchronization failures or incorrect wallet state and requiring a full state rebuild for recovery. This issue is fixed in version 4.5.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| ZcashFoundation zebra | < 4.5.0 | CVE List |
| ZcashFoundation zebra-state | < 7.0.0 | CVE List |
| zebra-state (crates.io) | before 7.0.0 | GitHub Advisory Database |
| zebrad (crates.io) | before 4.5.0 | GitHub Advisory Database |
All scores
| GitHub_M | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:L |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:L |
Classification
What each source says
CVE List
ZEBRA is a Zcash node written entirely in Rust. Prior to 4.5.0, a natural or attacker-influenced chain fork can leave stale Sapling and Orchard note-commitment subtree roots in Zebra state. In zebra-state/src/service/non_finalized_state/chain.rs, Chain::pop_tip removed a reverted tip block but did not remove subtree entries whose end_height belonged to that block, unlike the cleanup performed by pop_root. When the winning fork later finalized, the abandoned branch's stale subtree data could be written to RocksDB and survive node restarts. The corrupted history can cause z_getsubtreesbyindex consumers such as lightwalletd and light wallets to receive incorrect subtree roots, producing wallet synchronization failures or incorrect wallet state and requiring a full state rebuild for recovery. This issue is fixed in version 4.5.0.
GitHub Advisory Database
Am I affected
You are affected if:
- You run
zebradup to and includingv4.4.1. - Your node participates in a network where chain forks occur (mainnet, testnet, or any network with multiple miners).
All default configurations are affected. The corruption persists across restarts because it is written to RocksDB.
Summary
When pop_tip removes the tip block during a chain fork, stale Sapling and Orchard note commitment subtree root data is retained in the in-memory non-finalized state. When the chain subsequently finalizes, this stale data is written to the persistent RocksDB state. The corrupted subtree root history affects z_getsubtreesbyindex (used by lightwalletd for wallet synchronization) and could affect future chain verification that depends on correct subtree roots.
Details
The non-finalized state provides two methods for removing blocks: pop_root (removes the oldest block during finalization) and pop_tip (removes the newest block during a fork revert). pop_root correctly cleans up note commitment subtree contributions. pop_tip does not: it removes the block but retains the block's subtree root contributions in the in-memory state.
When a chain fork occurs and pop_tip reverts the old tip, the winning fork's chain is extended. When that chain is later finalized, the stale subtree data from the reverted blocks is included in the RocksDB write batch and persisted to disk.
The pop_root/pop_tip asymmetry is specific to subtree root handling. Other state managed by pop_tip (nullifiers, UTXOs, anchors, block hashes) uses different cleanup patterns that are not affected.
Patches
zebra-state 7.0.0 and zebrad 4.5.0.
The fix adds subtree root cleanup to pop_tip matching the pattern already used by pop_root.
Workarounds
There is no configuration-level workaround. Chain forks are natural events on any Proof-of-Work network. Operators can mitigate the downstream impact by periodically verifying subtree root consistency using z_getsubtreesbyindex against a known-good reference.
Impact
Persistent corruption of Sapling and Orchard subtree root history in the RocksDB state database. The corruption survives node restarts. Downstream consumers that rely on z_getsubtreesbyindex for wallet synchronization (primarily lightwalletd and light wallets) receive incorrect subtree roots. This does not directly affect consensus validation of new blocks but can cause wallet synchronization failures or incorrect wallet state. Recovery requires rebuilding the state database from scratch.
Credit
Reported by @dingledropper via a private GitHub Security Advisory submission.
NVD (es)
ZEBRA es un nodo Zcash escrito completamente en Rust. Antes de la versión 4.5.0, una bifurcación de cadena natural o influenciada por un atacante puede dejar raíces de subárbol de compromiso de notas Sapling y Orchard obsoletas en el estado de Zebra. En zebra-state/src/service/non_finalized_state/chain.rs, Chain::pop_tip eliminó un bloque de punta revertido pero no eliminó las entradas de subárbol cuyo end_height pertenecía a ese bloque, a diferencia de la limpieza realizada por pop_root. Cuando la bifurcación ganadora se finalizó más tarde, los datos de subárbol obsoletos de la rama abandonada podrían escribirse en RocksDB y sobrevivir a los reinicios del nodo. El historial corrupto puede causar que los consumidores de z_getsubtreesbyindex, como lightwalletd y las carteras ligeras, reciban raíces de subárbol incorrectas, produciendo fallos de sincronización de la cartera o un estado de cartera incorrecto y requiriendo una reconstrucción completa del estado para la recuperación. Este problema está solucionado en la versión 4.5.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-52733 changed 2026-08-19 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-2gf8-q9rr-jq3h changed 2026-07-02 | CC-BY-4.0 |
| NVD | CVE-2026-52733 changed 2026-11-09 | Public domain |