Backporting Upstream Bitcoin Core CVEs to a Post-Quantum Architecture
Software architectures that fork mature codebases face a continuous operational challenge: maintaining alignment with upstream security advisories. When building btq-core as a post-quantum Layer 1 network, we adopted Bitcoin Core 26.0 as our foundational baseline. The goal was deliberate: retain Bitcoin’s proven UTXO model, memory management discipline, and transaction verification flow while adding a post-quantum signature standard, ML-DSA-44, alongside the elliptic curve schemes.
On August 1, 2026, an internal review logged as issue #120 triaged thirteen published Bitcoin Core advisories and found that six applied to the btq-core 26.0 baseline. By August 6, 2026, five days later, all six fixes were merged. One of them, for a CPU denial of service issue, reduced sighash work on a dense test transaction from 147 ms to 2.4 ms.
Dissecting the 61x sighash benchmark
The most striking result from this cycle comes from the fix for CVE-2025–46598, which upstream rates Medium. Specially crafted unconfirmed transactions could take seconds each to validate and could be repeated at no cost to the sender.
Legacy sighash re-serializes the whole transaction on every call, so a script that forces many sighashes costs quadratic work. The backport in PR #149 caches the SHA-256 midstate so that a repeated script code within one input serializes the transaction once.
The measurement in PR #149 used a synthetic 200-input transaction taking 20,000 sighashes over one script code. That workload went from 147 milliseconds to 2.4 milliseconds, a 61x speedup. This figure measures sighash work on that transaction and does not describe all validation.
Upstream’s two other mitigations are also in: witness-stripping detection without re-running scripts (PR #139), and one script run per failing input (PR #149). BTQ also adds the signature version to the cache key, because CheckDilithiumSignature chooses its path by signature version inside a single input.
Script interpreter memory safety: CVE-2024–52911
The August set also included CVE-2024–52911, the only High of the six. A specially crafted block could remotely crash a node through a use-after-free in script validation.
Get Bitcoin Quantum’s stories in your inbox
Join Medium for free to get updates from this writer.
ConnectBlock dispatches script checks to background threads, and each check holds a pointer into precomputed transaction data. Our tree declared the two objects in the wrong order, so that data was freed before the check queue finished. The fix in PR #135 corrects the order.
The four additional upstream security fixes
In addition to the script validation and sighash fixes, the set closed four other advisories:
- CVE-2025–54604: repeated spoofed self-connections could fill the disk through unconditional logging.
- CVE-2025–54605: repeated invalid blocks could fill the disk the same way. One backported change, rate limits on log sources, closes both.
- CVE-2025–46597: a crash on 32-bit systems in an edge case, closed by capping
-maxmempool. - CVE-2024–52919: a crash from prolonged address message spam, closed by widening the addrman entry ID past 32 bits.
What the triage showed
Issue #120 also recorded that the tree had no upstream merges after its December 2023 baseline. Seven of the thirteen advisories did not apply, and some patches could not be cherry-picked. PR #137, for example, was applied by hand because later upstream code and BTQ’s renames blocked a clean apply.
Our post-quantum work adds NIST-standardized ML-DSA-44 signatures on top of that 26.0 baseline. Tracking upstream advisories remains regular work for the project.
Current deployment status on testnet
All six fixes are in the v0.5.0-testnet release of August 20, 2026.
Node operators on older builds should update. The issue and pull requests above are public in the btq-core repository.










