# QBTC security hardening 2 — 22 October 2026

This follows SECURITY-REVIEW-2026-10-22.md and the security1 release, baseline `618bcf5bf64dd285eeea0da8ea49e508498422db`. It is an internal correction/validation pass, not an independent audit. The network remains experimental, and the Site remains owner-only. This release preserves test-v2 network ID, genesis, calibrated difficulty, data directory and wallets. It does not activate the official network or reset test-v2 balances.

## Implemented corrections

1. **Bound expensive unconfirmed work.** A shared monotonic token budget allows a burst of eight novel transactions and refills at two per second, covering remote submissions and sync-import admission. Normal internal mempool restoration/pruning is not charged. Structural/size preflight still runs before cryptography; duplicate detection now uses a bounded transaction-ID set instead of repeatedly hashing the whole pool. Public S/B/P read queries have a separate burst-32/refill-16-per-second budget. These are local policies, not block consensus. They bound work and do not establish distributed denial-of-service immunity: a hostile population can still consume public quotas or connection slots.
2. **Keep local health checks available during public quota exhaustion.** The panel/backend now use `qbtc-peer local-status CONTROL_PORT --control-file FILE`. The S request on the separate loopback control interface is protected by the existing per-instance HMAC secret, timestamp and replay cache; malformed or forged requests are rejected. Authenticated local status bypasses public read quotas, without opening the wallet or asking for its password. P2P status remains public and rate-limited. The control-file path, not its secret value, is passed in arguments. Default TCP ports and native P2P wire profile remain unchanged.
3. **Cache active history indexes.** Sync responses and block locators reuse an active-chain vector/index until the tip changes. Prepared caches are swapped only after construction. Mining and reorganization tests verify refresh to the actual new tip, avoiding stale-branch responses. This reduces repeated full-index work; it does not remove storage/index capacity limits.
4. **Confirm the actual payment inside the signer.** Before loading the signing key, the native signer displays the canonical recipient, exact eight-decimal QBTC amount and fee. It requires the literal word `SEND` followed by a complete line, then the hidden wallet password. Cancellation, EOF or an overlong confirmation cannot sign. This uses already parsed arguments, independent of later request-file edits. It improves review of clipboard/request substitution but does not defend against a replaced signer or compromised user account. A user must actually compare the displayed destination.
5. **Bound password input.** Console password acquisition accepts a nonempty completed line of at most 1,024 bytes, reserves its buffer up front and clears collected bytes on rejection. Normal password cleanup remains in place. No claim is made that every OS, terminal, library or dump copy of sensitive data can be erased. Balance refresh and masking still require no wallet password.
6. **Rebuild Tor runtime from verified content on every launch.** The cached vendor archive is SHA-256 checked against the existing pinned value before extraction. Each launch extracts into a fresh staging directory, requires one tor.exe and replaces the old executable/runtime tree. Old extra DLLs are not reused. A failed hash/extraction/layout check does not execute that content and preserves the previous runtime tree until a replacement is ready. Onion identity and Tor state live outside this runtime directory and are retained. Missing archives are downloaded once through the existing pinned acquisition path; staging downloads are cleaned on failure. This does not protect against a compromised OS or a same-user attacker replacing the application/verifier itself.

## Verification performed

- New request-budget unit test passed under AddressSanitizer/UndefinedBehaviorSanitizer: burst ceiling, fractional refill, backward time and long-idle cap.
- New disposable Regtest Node test passed under ASan/UBSan: cache refresh after mining and reorganization, locator tip correctness, duplicate transaction admission, invalidation after confirmation, rate-limited novel invalid traffic and no chain mutation from that traffic.
- Updated wallet suite passed under ASan/UBSan: 2,108 checks. The previous eleven-suite security1 results remain the historical base; the affected wallet suite was rebuilt and rerun. This increment adds two new native suites; it is not a claim that all prior suites were independently rerun after every source edit.
- ASan/UBSan-linked native signer/fixture passed real Linux PTY checks: cancelled/empty/overlong confirmation cannot sign; SEND plus a correct hidden fixture password produces a transaction; exact recipient/amount/fee appear; a 1,025-byte password is rejected; wallet and chain files remain unchanged. Disposable Regtest keys only.
- Real native TCP regression checks passed: oversized header-only submit refusal; prohibition of public mining control; onion-mode localhost address-injection refusal; public-read quota exhaustion; authenticated local status still succeeds; forged control status fails; high-descriptor listeners fail safely. No blocks or live wallet files were used in these TCP checks.
- PowerShell verified-runtime fixture checks passed: old rogue file removed on replacement; wrong checksum, corrupt archive and absent executable rejected; no fixture executable was run and the existing tree survives failed installation.
- Twelve backend lifecycle checks passed using real native height-zero nodes and simulated Tor/SOCKS, including the new verified-archive extraction path and authenticated health check. Windows process-ownership interfaces are mocked by the Linux fixture.
- PowerShell parsing and strict native C++ warning checks passed. Updated peer and wallet binaries were cross-built for Windows x64 with the existing GCC/MinGW and pinned static OpenSSL toolchain.

Actual Windows execution of these new behaviors remains pending. LeakSanitizer remains unavailable in this executor; no memory-leak scan is claimed. The OpenSSL static library itself is not sanitizer-instrumented. Reproduction assets are in the source download: native-source/scripts/security-checks.py, native-source/tests/test_request_budget.cpp, native-source/tests/test_node_policy.cpp, developer-tests/test_signer_confirmation.py, developer-tests/test_security_transport.py and developer-tests/test_verified_tor.py.

## Preserved limitations and next work

The security1 64 KiB relay policy remains conservative (roughly twelve full ML-DSA inputs). Larger single payments may require smaller separately confirmed payments/consolidation; automatic batching is not implemented. Consensus-valid blocks are not restricted by these relay policies. A transaction admission rate-limit refusal is not confirmation: retry the already signed transaction rather than constructing a duplicate payment.

Peer/Sybil/eclipse resistance, multiple genuinely independent native outbound views, minority-network hashpower attacks, finite journal/index/UTXO budgets and long-running resource pressure remain open. Publisher signing, independently reproducible builds, independent security review, clean-machine recovery/spend drills and adversarial native Windows/real-Tor tests remain outstanding. The original review's extracted-runtime reuse and signer-confirmation gaps are addressed by this release; its broader compromised-host and supply-chain cautions remain.

## Updating the private test

Close both old panels and extract the complete new ZIP into a new folder. Open QBTC.exe. Existing QBTC-test-v2 state is reused. The first start can download the 21 MiB pinned archive if the old installation had retained only the extracted runtime. Payments now require typing SEND in the signer's confirmation console. No command-line setup is needed. Do not label this release an independent audit or a guarantee of safety for real funds.
