Security & 2026-11-27 Full Audit Remediation Report
Complete engineering record of the 2026-11-27 full 8-track code audit (~363,183 LOC / 258 files reviewed) and the Wave 1 + Wave 2 remediation campaign resolving 15/15 CRITICAL, 21/21 HIGH, and 12 high-impact MEDIUM defects across Linux x86-64, macOS Apple Silicon (ARM64), and CUDA.
- Zero remote memory-safety bugs left from the audit: Fixed inbound
getblocktxn.bssoverflow (CRIT-01),script_asm()heap overflow (CRIT-03),node_fetch_headersstack overflow on x86-64/ARM64 (CRIT-04),cons_verify1 MiB stack overlap (CRIT-02), PSBT/raw-tx bounds overflows (CRIT-05), and uninitialized-stackmunmap/closeon macOS (CRIT-07, H-15). - Consensus, Funds & Mempool Integrity: Fixed P2TR/P2WSH
prog32zero-length bug (CRIT-08),addhdkeyxprv corruption & BnB overrun (CRIT-06), mempool duplicate-input /MAX_MONEYchecks (CRIT-09), atomic multi-tx package rollback + ephemeral-dust lookup (CRIT-10), Miniscriptthresh(>255)(CRIT-11), live fee estimation & BIP133feefilterwiring (H-01, H-02), and contextualbad-version/BIP94 enforcement on submitted/pushed blocks (H-06). - DoS, Privacy & Concurrency: Replaced O(N) chain scan in
getblocktxnwith O(1)ht_idxlookup + hash verification (H-08), eliminated Tor/proxy clearnet leaks inaddr_gather_from& added full SOCKS5 stream isolation (H-10), hardened HTTP framing against request smuggling (MED-09), yieldedg_exec_lock+ enforced 30s process-group timeout on external signers (H-17), and eliminated multithreaded data races in RPC, Esplora, and MuSig2 (H-16, H-18, MED-10). - Storage Durability & Process Safety: Protected
store_truncate_toagainst boundary holes (CRIT-12), fixedstore_prunefd mismatch (CRIT-13), deduplicated & fail-closed WAL tombstone reload (H-13), added on-disk tail truncation on reorg (H-14), added DarwinF_FULLFSYNCbarriers & hardened macOS compiler flags (H-20), and replaced unsafeSIGCHLD=SIG_IGNwaitpid()calls with pipe synchronization (CRIT-14, CRIT-15).
2026-11-29 Formal Verification Campaign (v0.2.1)
Full 4-suite re-verification against v0.2.1 using CBMC 6.11.0 + CaDiCaL, Z3 5.3.1, TLC2 2.19, and angr, expanded with 3 new wallet & PSBT CBMC proofs and a tightened zero-branch constant-time assertion in formal/secp.
Full attestation: docs/audits/FORMAL_VERIFICATION_2026-11-29.md.
| Suite | Solver / Engine | Verified Proofs & Checks | Mutants | Verdict |
|---|---|---|---|---|
formal/secp |
x86-64 Symbolic Lifter + Z3 5.3.1 | 80 / 80 unbounded ASM proofs (incl. 27 / 27 CT proofs with 0 forced branches across sc_split_lambda & GLV avx2/cmov) + 2,342 lifter-vs-CPU runs |
ct_forced == [] enforced |
ALL PASS |
formal/arith |
CBMC 6.11.0 + CaDiCaL + Z3 5.3.1 + angr | 142 / 142 consensus arithmetic checks (money, locks, pow, limits, scriptnum) vs Bitcoin Core |
All caught | ALL PASS |
formal/storage |
TLC2 2.19 (OpenJDK 21) + Crash Driver | 30 / 30 TLA+ configs (80,970,455 distinct states in fixed-ext4-async-n3full) + 42 / 42 test_sto_crash healed |
6/6 TLA+ & 6/6 C/ASM | ALL PASS |
formal/parsers |
CBMC 6.11.0 + CaDiCaL | 19 / 19 bounded proofs (16 existing + 3 new v0.2.1: P-PSBTUPD, P-COINSEL, P-COINSEL-BNB), 100% cover goals, 7 / 7 Core divergences GONE |
27 / 27 caught | ALL PASS |
FV-2026-11-29-01(asm/wallet_coinsel.c): CBMC (P-COINSEL) caught apickcap <= 0out-of-bounds write topick[0]and silent subset truncation inwallet_knapsack_select()that returned coin sets withsum < targetwhen selected coins exceededpickcap. Fixed with strict bounds/overflow checks andlowest_largerfallback; verified byP-COINSEL(7/7cover,2/2mutants caught) and 5 new regression tests intest_coinsel.c(18/18 PASS).FV-2026-11-29-02(asm/psbt_update.c): Identified missing1 + n_in + n_outmap-terminator byte count inpsbt_update_bytes_from_descs()outcapsizing (latentoutbufoverrun above 26 empty maps) plus addition-overflow checks inwalk_tx()andar(). Fixed and verified byP-PSBTUPD(10/10cover,3/3mutants caught including the exactv0.2.1witness_utxowraparound shape).- Zero-Branch CT Exemption Removed (
formal/secp/proofs_ct.py): Permanently deleted the obsoletejne <sc_split_lambda.bad>branch exemption after all 27 constant-time x86-64 proofs verified with 0 forced branches.
Complete 2026-11-27 Remediation Ledger
Filter by severity or search by finding ID, file, or subsystem:
| ID | Severity | Wave | Component & Files | Defect & Remediation Summary | Status |
|---|---|---|---|---|---|
CRIT-01 | CRITICAL | Wave 1 | asm/bitcoin_serve.asm, port/osx/bitcoin_serve.S | Inbound getblocktxn compared byte offset against virtual address and truncated indices to 16 bits. Fixed bounds check against 8 MiB capacity with overflow guard and rejected indices ≥ 0x10000. | FIXED |
CRIT-02 | CRITICAL | Wave 1 | asm/bitcoin_cons.asm | cons_verify 1 MiB stack buffer overlapped locals and saved rbx. Realigned frame reservation so the 1 MiB scratch sits cleanly below all locals with 16-byte stack alignment. | FIXED |
CRIT-03 | CRITICAL | Wave 1 | asm/rpc_chain.c | Heap overflow & size_t underflow via unchecked snprintf truncation in script_asm(). Replaced with checked dynamic buffer growth before every append. | FIXED |
CRIT-04 | CRITICAL | Wave 1 | asm/bitcoind.asm, port/osx/bitcoind.S | Stack buffer overflow in node_fetch_headers for multi-hash locators (≥3 hashes on ARM64, ≥8 on x86-64). Expanded buffer to ≥1152 bytes and capped locator count ≤ 32. | FIXED |
CRIT-05 | CRITICAL | Wave 1 | asm/rpc_commands.c, asm/rpc_wallet_ops.c | Stack/.bss overflows and OOB reads in psbt_decode_common, cmd_fundrawtransaction, cmd_signrawtransactionwithkey, and psbt_process. Enforced strict key/tx length bounds everywhere. | FIXED |
CRIT-06 | CRITICAL | Wave 1 | asm/rpc_wallet_ops.c, asm/bitcoin_bip32.asm, port/osx/bitcoin_bip32.S, asm/wallet_bnb.c | cmd_addhdkey passed 33-byte key to bip32_extkey_serialize overflowing ser[78] and corrupting xprvs; wallet_bnb_select overran pickcap. Fixed caller, clamped priv keylen ≤ 32, and enforced BnB backtrack at depth limit. | FIXED |
CRIT-07 | CRITICAL | Wave 1 | port/osx/bitcoin_idxscan.S, port/osx/bitcoind.S, port/osx/node_log.S | Uninitialized stack read & arbitrary close() on openat failure plus Darwin svc #0x80 carry-flag bug in _idxscan_progress. Fixed error branches and carry-flag checks. | FIXED |
CRIT-08 | CRITICAL | Wave 1 | asm/wallet_core.c | wallet_validate_address_ex omitted *proglen = 32 for P2TR and P2WSH, leaving caller's prog32 uninitialized. Set *proglen = 32 with capacity check on both paths. | FIXED |
CRIT-09 | CRITICAL | Wave 1 | asm/bitcoin_mempool_policy.c | Mempool admission lacked duplicate-input and MAX_MONEY / output-sum overflow checks. Added strict duplicate prevout, non-null prevout, per-output ≤ MAX_MONEY, and cumulative sum checks. | FIXED |
CRIT-10 | CRITICAL | Wave 1+2 | asm/bitcoin_mempool_policy.c, asm/daemon/tx_accept.c, asm/daemon/tx_relay.c, asm/daemon/main.c | Ephemeral dust missed parents staged only in package overlay (Wave 1), and Pass-2 commits lacked rollback (Wave 2). Added package-overlay lookup and reverse-order rollback via tx_accept_rollback_tx(). | FIXED |
CRIT-11 | CRITICAL | Wave 1 | asm/miniscript.h, asm/miniscript.c | ms_node_t.nsubs truncated thresh() counts to uint8_t. Widened nsubs to uint32_t and validated bounds cleanly across Tapscript (>255 subs). | FIXED |
CRIT-12 | CRITICAL | Wave 1 | asm/bitcoin_store.asm, port/osx/bitcoin_store.S | store_truncate_to wiped the entire block archive when target_height + 1 was an all-zero hole. Added hole detection rejecting truncation cleanly without modifying files. | FIXED |
CRIT-13 | CRITICAL | Wave 1 | asm/bitcoin_store.asm, port/osx/bitcoin_store.S | store_prune ignored store_set_prune failure and left cur_blk_fd mismatched with cur_file_no. Checked return and closed/reset cur_blk_fd = -1 after compaction. | FIXED |
CRIT-14 | CRITICAL | Wave 1 | asm/daemon/index_trail.c | Under SIGCHLD=SIG_IGN, waitpid() returned ECHILD which reap() treated as success, deleting live tails after crashed builders. Replaced with status pipe verification + target file existence check. | FIXED |
CRIT-15 | CRITICAL | Wave 1 | asm/daemon/notify.c | notify_run() called waitpid() under SIGCHLD=SIG_IGN, blocking the download worker until all children exited. Replaced with CLOEXEC pipe synchronization. | FIXED |
H-01 | HIGH | Wave 1 | asm/daemon/tx_accept.c | g_pol_state_for_fees was assigned before g_pol_state initialized, permanently disabling live estimatesmartfee & BIP133 feefilter. Fixed initialization order. | FIXED |
H-02 | HIGH | Wave 1 | asm/bitcoin_serve.asm, port/osx/bitcoin_serve.S | Inbound feefilter command compare matched "ilt\0" instead of "ilte". Corrected compare on both architectures. | FIXED |
H-03 | HIGH | Wave 1 | asm/bitcoin_net.asm | p2p_read_core clobbered fd_read_full return value, ignoring short reads. Preserved and checked return before accepting payload. | FIXED |
H-04 | HIGH | Wave 1 | asm/rpc_server.c | 63-byte username truncation in auth_ok() bypassed -rpcwhitelist for ≥64-char usernames. Widened TLS buffer to 256 bytes matching rpcuser[256]. | FIXED |
H-05 | HIGH | Wave 1 | asm/daemon/utxo_live.c, asm/daemon/blk_submit.c | Pointer-wrap OOB read in val_read_tx and block submission parser. Replaced pointer addition checks with overflow-free remaining-byte checks. | FIXED |
H-06 | HIGH | Wave 1 | asm/daemon/utxo_live.c | Submitted and pushed blocks bypassed contextual bad-version and BIP94 timewarp rules. Enforced hdr_contextual_ok and hdr_timewarp_ok across all apply paths. | FIXED |
H-07 | HIGH | Wave 1 | port/osx/bitcoin_cons.S | OOB read, non-0x01 SegWit flag acceptance, and 0xff witness count bug on ARM64. Brought into strict parity with x86-64 and Core. | FIXED |
H-08 | HIGH | Wave 2 | asm/bitcoin_serve.asm, port/osx/bitcoin_serve.S | Unauthenticated getblocktxn called node_serve_block_by_hash (full-chain ~1 TB disk scan per unknown hash). Switched to O(1) ht_idx lookup + STO-10 header-hash verification. | FIXED |
H-09 | HIGH | Wave 1 | asm/bitcoind.asm, port/osx/bitcoind.S | Unchecked -1 return from p2p_headers_count in node_sync_multi. Added signed < 0 rejection on both architectures. | FIXED |
H-10 | HIGH | Wave 2 | asm/daemon/addr_ingest.c, asm/daemon/dialer.c | addr_gather_from() bypassed -proxy/-onlynet (clearnet IP leak), and proxied IPv6/CJDNS/DNS dials omitted SOCKS5 stream isolation. Routed through dialer_connect and enforced dialer_isolation_creds on all proxied paths. | FIXED |
H-11 | HIGH | Wave 1 | asm/rpc_server.c, asm/daemon/main.c | Stale BIP324 v2 cipher state on fd reuse and leaked Esplora/RPC listener FDs across fork(). Added bmc_v2_close on teardown, FD_CLOEXEC, and child close of g_esp_fd. | FIXED |
H-12 | HIGH | Wave 1 | asm/daemon/tx_accept.c | Hard-coded 512-input cap failed open in txacc_sigop_cost and txacc_witness_standard. Replaced with dynamic allocation supporting arbitrarily many inputs. | FIXED |
H-13 | HIGH | Wave 2 | asm/bitcoin_utxo_lsm.asm, port/osx/bitcoin_utxo_lsm.S | utxo_lsm_reload appended duplicate WAL tombstones and silently dropped/aborted past tomb_cap (resurrecting spent UTXOs). Added probe-first deduplication and fail-closed -1 return on overflow. | FIXED |
H-14 | HIGH | Wave 1+2 | asm/daemon/bfilter_index.c, asm/daemon/tx_index_tail.c, asm/daemon/txosp_tail.c | Reorg closed bfilter fd before truncating (Wave 1), and txindex.tail / txospender.tail left stale post-reorg records on disk (Wave 2). Added atomic on-disk tail truncation on reorg and boot. | FIXED |
H-15 | HIGH | Wave 2 | port/osx/bitcoin_store_fast.S | _store_map_init / _store_map_close called munmap() on uninitialized slots without checking MAP_MAGIC. Added MAP_MAGIC verification before unmapping. | FIXED |
H-16 | HIGH | Wave 1+2 | asm/rest.c, asm/rpc_chain.c, asm/rpc_node.c | Fixed unauth POST /rest/getutxos.hex 4.5 MB/req leak (Wave 1); eliminated data races in opname() (const table), g_pri[] (g_pri_mu mutex + snapshot), and cmd_abortprivatebroadcast (stack buffer). | FIXED |
H-17 | HIGH | Wave 2 | asm/rpc_signer.c, asm/rpc_signer.h | External signer blocked indefinitely while holding exclusive g_exec_lock. Yielded g_exec_lock under dedicated g_signer_mu, isolated signer in own process group, and enforced 30s poll() timeout + SIGTERM/SIGKILL cleanup. | FIXED |
H-18 | HIGH | Wave 1+2 | asm/rpc_wallet_ops.c, asm/musig2.c, asm/musig2.h, asm/wallet_core.c | Wiped g_hdk on wallet switch/unload (Wave 1); moved MuSig2 buffers off static .bss onto stack, wiped all MuSig2/BIP39 secret intermediates, and added musig2_secnonce_wipe() (Wave 2). | FIXED |
H-19 | HIGH | Wave 1 | asm/rpc_commands.c, asm/bip32_ckdpub.c, asm/wallet_msgsign.c, asm/rpc_wallet_ops.c | Fixed BIP143 SIGHASH_SINGLE bug, msg_digest stack overflow, CRY-2 borrow-wrap & x==p checks, and enforced 0600 O_NOFOLLOW + fsync on wallet backups. | FIXED |
H-20 | HIGH | Wave 1+2 | port/osx/bitcoind.S, port/osx/build_*.sh, port/osx/run_tests.sh, asm/cuda/*.cu, asm/bmc_fsync.h | Fixed ARM64 IBD slot aliasing, added -fstack-protector-strong -D_FORTIFY_SOURCE=2, set -o pipefail, CUDA BIP340/SHA256 bounds/math fixes (Wave 1), and Darwin F_FULLFSYNC durability helper (Wave 2). | FIXED |
H-21 | HIGH | Wave 1+2 | asm/daemon/node_config.c, asm/daemon/zmq_notify.c, asm/daemon/main.c | Rejected out-of-range par= values, advanced lapped ZMQ sequence cursors (Wave 1), and invoked zmqpub_close() on worker shutdown (Wave 2). | FIXED |
MED-01 | MEDIUM | Wave 2 | asm/daemon/tx_verify.c | Fixed dangling g_txv_in pointer if first realloc() succeeded and second failed by committing each capacity update atomically. | FIXED |
MED-02 | MEDIUM | Wave 2 | asm/daemon/tx_verify.c | Added fork-PID guard in txvb_pool_ensure() so forked children spawn fresh script-verify threads instead of deadlocking on dead parent handles. | FIXED |
MED-03 | MEDIUM | Wave 2 | asm/daemon/tx_verify.c | Guarded tx_legacy_sigops() < 0 against unsigned (u64)(-1) * 4 wrap, failing closed above MAX_BLOCK_SIGOPS_COST. | FIXED |
MED-04 | MEDIUM | Wave 2 | asm/daemon/mempool_cfg.c | mp_lock_at() now fails loudly and aborts on non-EOWNERDEAD mutex errors (ENOTRECOVERABLE/EINVAL) instead of running unprotected. | FIXED |
MED-05 | MEDIUM | Wave 2 | asm/daemon/fee_estimator.c | Fixed unsigned bin underflow when height < confct on early blocks, and added isfinite() + non-negative validation when loading fee_estimates.dat. | FIXED |
MED-07 | MEDIUM | Wave 2 | asm/daemon/banlist.c | Replaced fixed 64 KiB read buffer in banlist_load() with dynamic fstat() + malloc() (up to 16 MiB) so large banlists never truncate. | FIXED |
MED-08 | MEDIUM | Wave 2 | asm/daemon/cmpct_recv.c | Copied mempool-matched transactions into S.pre (8 MiB) inside cmpct_recv_cmpctblock() so pointers cannot dangle into compactable shared mempool blobs across getblocktxn round trips. | FIXED |
MED-09 | MEDIUM | Wave 2 | asm/rpc_server.c | Added strict parse_content_length() rejecting Transfer-Encoding, duplicate Content-Length, negative/non-numeric/oversize lengths with 400 Bad Request on both RPC and Esplora listeners. | FIXED |
MED-10 | MEDIUM | Wave 2 | asm/rpc_esplora.c | Added g_mp_refreshing re-entrancy guard around mp_refresh_locked() across lock releases and NULL checks on all realloc() calls. | FIXED |
MED-11 | MEDIUM | Wave 2 | asm/utxo_lsm_mm.c | Registered a pthread_key destructor (mm_thread_dtor) to cleanly munmap() and close() per-thread LSM run cache slots on thread exit. | FIXED |
MED-12 | MEDIUM | Wave 2 | asm/daemon/main.c | Expanded four 162 KB tx_txid scratch buffers in the worker submit loop to 1 MiB so large valid transactions never fail txid hashing. | FIXED |
MED-13 | MEDIUM | Wave 2 | scripts/makefile_prereq_audit.py | Auto-detects GNU Make ≥ 4.0 (gmake on macOS) and fails loudly instead of silently passing with 0 rules checked under GNU Make 3.81. | FIXED |
Cross-Platform Verification Matrix
| Platform / Gate | Checks Executed | Result |
|---|---|---|
| Static Auditors | abi_stack_audit --external-only (482 fns), abi_callee_saved_audit (482 fns), makefile_prereq_audit (629 rules), makefile_runlist_audit (487 sources / 474 gated), log_literal_len_check | ALL PASS |
| Linux x86-64 Full Gate | make -C asm test + gate-log-check at commit 025a5e16 (483 gated tests, ASan+UBSan san-check, link-check, script-flags-check vs Core v31.1, 16-check test_audit_2026_11_27) | 483/483 PASS |
| macOS Apple Silicon Gate | Hardened -Wall -Werror -fstack-protector-strong -D_FORTIFY_SOURCE=2 daemon + 18 tools + 6 helpers + port/osx/run_tests.sh | 455 PASS / 0 FAIL |
| Live Mainnet Production Node | Atomic deploy (commit 025a5e16, bmc_build_dirty: false), synced at mainnet tip 977,862 (warnings: []), mempool loaded (12,905 txs, optimal: true), live estimatesmartfee 6 = 0.00002226 | VERIFIED LIVE |
Continuous Fuzzing Ledger & Audit History
docs/audits/FUZZING_ATTESTATION.md)2026-11-28 (commit 579e9b61), the 24/7 bmc-fuzz.service runner has logged
248.70 billion (248,702,148,162) mutated executions across 7 targets (guard-paged x86-64 NASM, ASan/UBSan C,
and 36.44 billion in-process Bitcoin Core v31.1 EvalScript differential comparisons) with
0 crashes and 0 consensus mismatches. Cumulative totals are persisted atomically in fuzz/fuzz_stats.json
and rendered via fuzz/record_fuzz_stats.py into
docs/audits/FUZZING_ATTESTATION.md.
See Continuous Fuzzing & Assembly Validation for architecture diagrams, per-target rates, caught ARM64 bugs, and honest scope limits.
- 2026-11-29 (
v0.2.1Formal Verification): Full 4-suite re-verification (formal/secp80/80 PROVED with 0 forced CT branches,formal/arith142/142 PASS,formal/storage30/30 TLC2 + 42/42 real-code crash tests + 6/6 mutants,formal/parsers19/19 CBMC proofs + 27/27 mutants + 7/7 Core divergences GONE), adding 3 new wallet/PSBT CBMC proofs (P-PSBTUPD,P-COINSEL,P-COINSEL-BNB) and fixingFV-2026-11-29-01(wallet_knapsack_selectOOB/truncation) andFV-2026-11-29-02(psbt_updatemap-terminator sizing). Full report:docs/audits/FORMAL_VERIFICATION_2026-11-29.md. - 2026-11-28 (
v0.1.0): Shipped assembly-first continuous hardening infrastructure — AArch64 static ABI/syscall auditor (scripts/arm64_abi_audit.py), checked assembly cursor macros (asm/macros_safe.inc,port/osx/macros_safe.inc), dual-arch consensus spec codegen (scripts/gen_consensus_inc.py), 7-target guard-paged assembly + ASan/UBSan C + 2.06M exec/s in-process Core v31.1 differential script fuzzer (fuzz/, running 24/7 viabmc-fuzz.service), and cross-platform GitHub Actions CI + checksummed 3-platform release pipeline. Immediately caught and fixed 2 additional real ARM64 assembly bugs inport/osx/bitcoin_tx.S(transient 8-byte SP misalignment + remote0xffCompactSizex9-clobberSIGSEGV). - 2026-11-27: Full 8-track code audit (258 files / 363k LOC) & Wave 1 + Wave 2 remediation (15/15 CRITICAL, 21/21 HIGH, 12 MEDIUM fixed; regression suite
asm/tests/test_audit_2026_11_27.c). - 2026-10-23: Security review & formal verification across 4 areas (9 HIGH, 18 MEDIUM, 36 LOW fixed in PRs #424–#435; verified by from-genesis MuHash parity sync at height 972,848).
- 2026-09-03: Full codebase audit & remediation (
docs/audits/AUDIT_2026-09-03_REMEDIATION.md). - 2026-08-29 – 2026-09-02: Initial security & P2P/RPC hardening audits (
docs/audits/SECURITY_AUDIT_2026-08-29.md,SECURITY_AUDIT_2026-09-02.md).
Vulnerability Disclosure
Report security vulnerabilities privately via the repository's GitHub Security tab (“Report a vulnerability”).
Never post private keys, wallet files, seeds, .cookie credentials, or Tor/I2P keys in public issues or pull requests.
See SECURITY.md in the repository root for full scope and disclosure guidelines.