Assessment Report
Bitcoin Core
BIP460 CISA
CISA is witness v2 keypath aggregation for Taproot-shaped 32-byte programs.
Half-aggregation follows BIP458. Full aggregation follows BIP459 (DahLIAS).
BIP460 is the consensus encoding. This assessment covers
bitcoin/bitcoin#36122
at 224e15fd891334f0a2fb924d2ac60bc08ed9e4f3. Review ran
8-15 September 2026.
0Critical
1High
4Medium
2Low
5Info
Hackerbane · Assessment Report
HACK-AR-2026-BIP460-CISA
Contents
- -Document revision history
- -Contacts
- 1Executive overview
- 1.1Introduction
- 1.2What we found
- 1.3How this review was done
- 2Scoring (BVSS)
- 2.1Exploitability
- 2.2Impact
- 2.3Severity coefficient
- 2.4Scope
- 3Findings overview
- 4Findings
- 4.1(HACK-01) VERIFYSCRIPT RETURNS SUCCESS FOR AGGREGATED KEYPATH SPENDS WITHOUT CHECKING AN AGGREGATE SIGNATURE
- 4.2(HACK-02) SOLVER AND DESCRIPTORS TREAT WITNESS V2 AS CISA BEFORE ANY PUBLIC CHAIN ACTIVATES IT
- 4.3(HACK-03) PSBT MERGE DOES NOT REJECT CONFLICTING HALF-AGGREGATION SIGNATURES
- 4.4(HACK-04) FINALIZECISAINPUTS SKIPS ALREADY-SIGNED MEMBERS AND CAN EMIT A SECOND GROUP
- 4.5(HACK-05) HIDINGSIGNINGPROVIDER EXPOSES FULL-AGGREGATION SECNONCES
- 4.6(HACK-06) CISACHECK NEVER USES THE SIGNATURE CACHE
- 4.7(HACK-07) SIGHASH_SINGLE AND HASHTYPE FAILURES ARE REPORTED AS CISA AGGREGATE-VERIFY FAILURES
- 4.8(HACK-08) CISAWITNESS DOCUMENTS THAT OPT-OUT SIGHASH IS NOT EXTRACTED, THEN ALWAYS STORES SIGHASH_DEFAULT
- 4.9(HACK-09) CHECKINPUTSCRIPTS UNDER-RESERVES THE CHECK QUEUE BY ONE
- 4.10(HACK-10) CORE VENDORS UNMERGED SECP256K1 HALFAGG AND FULLAGG MODULES
- 4.11(HACK-11) DEPLOYMENT_CISA DEFAULTS TO TESTDUMMY BIT 28 ON EVERY CHAIN EXCEPT REGTEST
- 4.12(HACK-12) CONSENSUS AND THE PSBT FINALIZER ALLOW ONLY ONE HALF-AGG GROUP AND ONE FULL-AGG GROUP PER TRANSACTION
- 5Recommendations
- 6Fuzz testing
- 7Static analysis
- 8Remediation record
- 9Exhibit B
Document revision history
| Version | Modification | Date |
| 0.4 | Assessment | 09/15/2026 |
| 0.5 | Executed feature_cisa.py, wallet_cisa.py, and RPC probes for HACK-01, HACK-03, HACK-04 | 09/15/2026 |
| 0.6 | Document ID changed from HB-AR-2026.3 to HACK-AR-2026-BIP460-CISA. No other changes. | 10/05/2026 |
Contacts
| Contact | Company | Email |
| Hackerbane | Hackerbane | hello@hackerbane.com |
1 Executive overview
1.1 Introduction
BIP460 CISA adds witness version 2 keypath spends that can share a
half-aggregate (BIP458) or full-aggregate (BIP459 DahLIAS) signature
across inputs. The implementation is in Bitcoin Core pull request 36122.
Activation in this tree is ALWAYS_ACTIVE on regtest only.
Hackerbane reviewed Bitcoin Core pull request 36122 at
224e15fd891334f0a2fb924d2ac60bc08ed9e4f3. Report date is
15 September 2026. Review ran 8 September 2026 through 15 September
2026. Scope, commit, and file list are in section 2.4.
1.2 What we found
ProduceSignature and DataFromTransaction set complete from
VerifyScript on a marked v2 keypath. A 32-byte dummy member is a
successful VerifyScript. Consensus still queues CISACheck, so a
block that runs that path still verifies the aggregate, and coins
do not move. Every caller that only consults VerifyScript treats
an unsigned member as signed (HACK-01).
CISACompatible accepts two different half-agg signatures on the
same input and Merge keeps the first (HACK-03). FinalizeCISAInputs
skips PSBTInputSigned members and can emit a second group of the
same mode, which consensus then rejects (HACK-04).
HidingSigningProvider still forwards DahLIAS secnonces on the PSBT
updater path (HACK-05). Solver and InferScript treat OP_2 32-byte
programs as CISA while DEPLOYMENT_CISA is unset on mainnet, testnet,
testnet4, and signet (HACK-02). Paying to that script already relays
on master as WITNESS_UNKNOWN. Default receive remains tr. No patch
was in the reviewed tree at report date. The rest of the list is
chapter 3 and 5.
Open Highs
| ID | Action | Status on 15 Sep 2026 |
| HACK-01 | In ProduceSignature and DataFromTransaction, do not set complete from VerifyScript alone when ParseCISAWitness yields a marker. Require VerifyCISATransaction on the full transaction. | OPEN |
1.3 How this review was done
Line-by-line read of the PR tree at
224e15fd891334f0a2fb924d2ac60bc08ed9e4f3 against Bitcoin
Core consensus and wallet call sites. The read included:
- GetBlockScriptFlags to VerifyWitnessProgram and VerifyCISATransaction.
- CheckInputScripts to CISACheck, including queue reserve and signature cache.
- Solver, MANDATORY_SCRIPT_VERIFY_FLAGS, STANDARD_SCRIPT_VERIFY_FLAGS.
- PSBT Merge, CISACompatible, FinalizeCISAInputs.
- ProduceSignature and DataFromTransaction completeness.
- HidingSigningProvider CISA nonce APIs versus GetKey.
- Vendored secp256k1 halfagg and fullagg modules as they appear in this tree.
- Execution of
test/functional/feature_cisa.py against a Release bitcoind built from this commit. The harness passed: regtest activation, v2 standard, opt-out, half-agg, full-agg, mixed groups, annex, script path, cross-mode, invalid structures, and invalid blocks on both the queued path and -par=1.
- Execution of
test/functional/wallet_cisa.py on the same binary. Descriptor receive, half-agg joinpsbts, full-agg nonce combine (conflicting nonces return PSBTs not compatible), reserved nonces, and MuSig2 half-agg all passed. That file does not conflict two half-agg signatures.
- RPC probes on the same binary for HACK-01, HACK-03, and HACK-04. Results are under those cards.
Fuzzing was not run. test_bitcoin unit tests were not re-run. See chapters 6 and 7.
2 Scoring (BVSS)
Each finding gets a BVSS vector. Exploitability is Attack Origin, Attack
Cost, and Attack Complexity. Impact is Confidentiality, Integrity,
Availability, Deposit, and Yield. The coefficient is Reversibility
times Scope. The printed score is min(10, E * I * C * 10), rounded up
to one decimal.
S = min(10, E * I * C * 10)
2.1 Exploitability
E is the product of Attack Origin (AO), Attack Cost (AC), and Attack Complexity (AX).
| Metric | Value | Numeric |
| Attack Origin (AO) | Arbitrary (AO:A) / Specific (AO:S) | 1 / 0.2 |
| Attack Cost (AC) | Low / Medium / High | 1 / 0.67 / 0.33 |
| Attack Complexity (AX) | Low / Medium / High | 1 / 0.67 / 0.33 |
AO:A means any account can attempt the call. AO:S means a specific account must be compromised. AC is cost relative to one transaction on the target chain. AX is conditions beyond the attacker.
2.2 Impact
Confidentiality (C), Integrity (I), Availability (A), Deposit (D), and Yield (Y).
Integrity and Availability exclude impact already counted under Deposit or Yield.
| None | Low | Medium | High | Critical |
| C / I / A / D / Y | 0 | 0.25 | 0.5 | 0.75 | 1 |
I = max(mI) + (sum(mI) - max(mI)) / 4
2.3 Severity coefficient
| Coefficient | Value | Numeric |
| Reversibility (R) | None / Partial / Full | 1 / 0.5 / 0.25 |
| Scope (S) | Changed / Unchanged | 1.25 / 1 |
C = R * S
| Band | Score |
| Critical | 9.0 - 10.0 |
| High | 7.0 - 8.9 |
| Medium | 4.5 - 6.9 |
| Low | 2.0 - 4.4 |
| Informational | 0.0 - 1.9 |
HACK-01 sets I:H because ProduceSignature and DataFromTransaction
mark an unsigned member complete from VerifyScript alone. That is
a false completeness oracle for every caller that does not also run
VerifyCISATransaction. A:L because CheckInputScripts still fails
CISACheck, so coins do not move. HACK-02 sets I:M and D:M because
InferScript will construct cisa() outputs while consensus CISA is
off on every public chain; default receive is still tr so the user
has to opt into a cisa() descriptor.
2.4 Scope
Code repositories:
1. Bitcoin Core CISA (PR 36122)
- Repository: bitcoin/bitcoin pull request 36122 (fjahr/bitcoin branch bip460).
- Commit ID:
224e15fd891334f0a2fb924d2ac60bc08ed9e4f3
- Related reading: BIP458, BIP459, BIP460 drafts in bitcoin/bips (PRs 2205, 2210, 2212). Those BIPs were Draft at review time.
Files in scope:
src/policy/policy.h, src/script/interpreter.h, src/script/interpreter.cpp
src/validation.cpp, src/kernel/chainparams.cpp, src/consensus/params.h
src/script/solver.cpp, src/script/descriptor.cpp, src/script/sign.cpp, src/script/signingprovider.cpp
src/psbt.cpp, src/cisa.h, src/cisa.cpp, src/pubkey.cpp
src/wallet/scriptpubkeyman.cpp, src/validation.h
src/secp256k1/src/modules/fullagg/main_impl.h
src/secp256k1/src/modules/schnorrsig_halfagg/main_impl.h
test/functional/feature_cisa.py and test/functional/wallet_cisa.py (executed on a Release build of this commit)
Out of scope:
- A merge of bitcoin-core/secp256k1#1566 or #1754 on the secp256k1 repository itself.
- Mainnet activation parameters and a published BIP460.
- Code after
224e15fd891334f0a2fb924d2ac60bc08ed9e4f3.
- Third-party libraries except the vendored secp modules named above.
3 Findings overview
| Critical | High | Medium | Low | Informational |
| 0 |
1 |
4 |
2 |
5 |
| Security analysis | Risk level | Remediation |
| (HACK-01) VERIFYSCRIPT RETURNS SUCCESS FOR AGGREGATED KEYPATH SPENDS WITHOUT CHECKING AN AGGREGATE SIGNATURE | High (8.2) | OPEN |
| (HACK-02) SOLVER AND DESCRIPTORS TREAT WITNESS V2 AS CISA BEFORE ANY PUBLIC CHAIN ACTIVATES IT | Medium (6.3) | OPEN |
| (HACK-03) PSBT MERGE DOES NOT REJECT CONFLICTING HALF-AGGREGATION SIGNATURES | Medium (6.3) | OPEN |
| (HACK-04) FINALIZECISAINPUTS SKIPS ALREADY-SIGNED MEMBERS AND CAN EMIT A SECOND GROUP | Medium (5.7) | OPEN |
| (HACK-05) HIDINGSIGNINGPROVIDER EXPOSES FULL-AGGREGATION SECNONCES | Medium (5.0) | OPEN |
| (HACK-06) CISACHECK NEVER USES THE SIGNATURE CACHE | Low (2.5) | OPEN |
| (HACK-07) SIGHASH_SINGLE AND HASHTYPE FAILURES ARE REPORTED AS CISA AGGREGATE-VERIFY FAILURES | Low (2.5) | OPEN |
| (HACK-08) CISAWITNESS DOCUMENTS THAT OPT-OUT SIGHASH IS NOT EXTRACTED, THEN ALWAYS STORES SIGHASH_DEFAULT | Informational (0.0) | OPEN |
| (HACK-09) CHECKINPUTSCRIPTS UNDER-RESERVES THE CHECK QUEUE BY ONE | Informational (0.0) | OPEN |
| (HACK-10) CORE VENDORS UNMERGED SECP256K1 HALFAGG AND FULLAGG MODULES | Informational (0.0) | OPEN |
| (HACK-11) DEPLOYMENT_CISA DEFAULTS TO TESTDUMMY BIT 28 ON EVERY CHAIN EXCEPT REGTEST | Informational (0.0) | OPEN |
| (HACK-12) CONSENSUS AND THE PSBT FINALIZER ALLOW ONLY ONE HALF-AGG GROUP AND ONE FULL-AGG GROUP PER TRANSACTION | Informational (0.0) | OPEN |
4 Findings
4.1 (HACK-01) VERIFYSCRIPT RETURNS SUCCESS FOR AGGREGATED KEYPATH SPENDS WITHOUT CHECKING AN AGGREGATE SIGNATURE
High (8.2)BIP460Witness / completenessCB-02OPEN
Description
For witness v2 keypath, after dropping an optional annex, VerifyWitnessProgram parses the remaining stack element with ParseCISAWitness. If that parse yields a marker (half-agg or full-agg, member or final), the function returns set_success and never calls CheckSchnorrSignature. That is the per-input structure check in BIP460. Consensus still queues CISACheck from CheckInputScripts when SpendsAggregatedWitnessV2Inputs is true, so a block that actually runs CISACheck still verifies the aggregate.
ProduceSignature and DataFromTransaction do not. They treat VerifyScript success under STANDARD_SCRIPT_VERIFY_FLAGS as sigdata.complete. A 32-byte half-agg member, an empty full-agg member, or a 65-byte dummy whose last byte is 0xbc or 0xbd is therefore a successful VerifyScript. DataFromTransaction returns complete=true for a member witness with no group final. Broadcast then fails mempool because CISACheck still runs. Callers that only consult VerifyScript treat the input as signed.
Code location
Listing 1: src/script/interpreter.cpp (Lines 2032-2041)
| 2032 | if (stack.size() == 1) { |
| 2033 | // Key path spending (stack size is 1 after removing optional annex) |
| 2034 | if (witversion == 2) { |
| 2035 | // BIP460: aggregated inputs are verified at transaction level |
| 2036 | // in VerifyCISATransaction(), opted-out inputs carry a plain |
| 2037 | // BIP341 signature and fall through. |
| 2038 | const auto parsed{ParseCISAWitness(stack.front(), serror)}; |
| 2039 | if (!parsed) return false; |
| 2040 | if (parsed->marker) return set_success(serror); |
| 2041 | } |
Listing 2: src/script/sign.cpp (Lines 913-921)
| 913 | if (!sigdata.witness) sigdata.scriptWitness.stack.clear(); |
| 914 | if (P2SH) { |
| 915 | result.emplace_back(subscript.begin(), subscript.end()); |
| 916 | } |
| 917 | sigdata.scriptSig = PushAll(result); |
| 918 | |
| 919 | // Test solution |
| 920 | sigdata.complete = solved && VerifyScript(sigdata.scriptSig, fromPubKey, &sigdata.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, creator.Checker()); |
| 921 | return sigdata.complete; |
Listing 3: src/script/sign.cpp (Lines 960-972)
| 960 | SignatureData data; |
| 961 | assert(tx.vin.size() > nIn); |
| 962 | data.scriptSig = tx.vin[nIn].scriptSig; |
| 963 | data.scriptWitness = tx.vin[nIn].scriptWitness; |
| 964 | Stacks stack(data); |
| 965 | |
| 966 | // Get signatures |
| 967 | MutableTransactionSignatureChecker tx_checker(&tx, nIn, txout.nValue, MissingDataBehavior::FAIL); |
| 968 | SignatureExtractorChecker extractor_checker(data, tx_checker); |
| 969 | if (VerifyScript(data.scriptSig, txout.scriptPubKey, &data.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, extractor_checker)) { |
| 970 | data.complete = true; |
| 971 | return data; |
| 972 | } |
Proof of concept
- Build a 2-input v2 transaction. Put a 32-byte dummy on both inputs (half-agg members, no final).
- Call VerifyScript on either input with STANDARD_SCRIPT_VERIFY_FLAGS. ParseCISAWitness classifies 32 bytes as a half-agg member and VerifyWitnessProgram returns true.
- ProduceSignature and DataFromTransaction treat that as complete. On this binary,
signrawtransactionwithwallet on that hex returns complete=true with no input errors. testmempoolaccept then rejects with mempool-script-verify-flag-failed (Invalid CISA aggregation group structure). CISACheck still runs. The completeness bit is wrong.
BVSS
AO:A/AC:L/AX:L/C:N/I:H/A:L/D:N/Y:N/R:N/S:U (8.2)
Recommendation
In ProduceSignature and DataFromTransaction, do not set complete from VerifyScript alone when ParseCISAWitness yields a marker. Require VerifyCISATransaction on the full transaction. Leave the per-input set_success for marked keypath as the structure check.
Status
Open in the reviewed tree.
4.2 (HACK-02) SOLVER AND DESCRIPTORS TREAT WITNESS V2 AS CISA BEFORE ANY PUBLIC CHAIN ACTIVATES IT
Medium (6.3)BIP460Wallet / policy typeCB-01OPEN
Description
Solver classifies OP_2 followed by a 32-byte program as WITNESS_V2_CISA. InferScript then builds a cisa() or rawcisa() descriptor from that scriptPubKey. GetNewDestination still uses the BECH32M tr path; a user has to import or write a cisa() descriptor. GetBlockScriptFlags only ORs SCRIPT_VERIFY_WITNESS_V2 when DeploymentActiveAt(..., DEPLOYMENT_CISA) is true. CRegTestParams is the only constructor that assigns that slot (bit 3, ALWAYS_ACTIVE). CMainParams, CTestNetParams, CTestNet4Params, and CSignetParams leave it at the BIP9Deployment default (bit 28, NEVER_ACTIVE).
MANDATORY_SCRIPT_VERIFY_FLAGS includes SCRIPT_VERIFY_WITNESS_V2. The comment on that constant says it does not affect consensus validity; GetBlockScriptFlags does. STANDARD_SCRIPT_VERIFY_FLAGS starts from the mandatory set and ORs SCRIPT_VERIFY_WITNESS_V2 again as its last term.
On current master, the same OP_2 32-byte program already classifies as WITNESS_UNKNOWN. IsStandard already accepts WITNESS_UNKNOWN, so those outputs already relay. Consensus already succeeds on unknown witness versions when the version-specific flag is off. Mempool already rejects those spends via SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM.
This tree additionally treats v2 as a defined CISA type. A wallet running this binary that uses a cisa() descriptor will pay to an output whose consensus spend, on every public chain in this binary, still takes the flag-off success path in VerifyWitnessProgram. A miner can include a garbage witness. Default receive remains tr.
Code location
Listing 4: src/script/solver.cpp Solver (Lines 142-181)
| 142 | TxoutType Solver(const CScript& scriptPubKey, std::vector<std::vector<unsigned char>>& vSolutionsRet) |
| 143 | { |
| 144 | vSolutionsRet.clear(); |
| 145 | |
| 146 | // Shortcut for pay-to-script-hash, which are more constrained than the other types: |
| 147 | // it is always OP_HASH160 20 [20 byte hash] OP_EQUAL |
| 148 | if (scriptPubKey.IsPayToScriptHash()) |
| 149 | { |
| 150 | std::vector<unsigned char> hashBytes(scriptPubKey.begin()+2, scriptPubKey.begin()+22); |
| 151 | vSolutionsRet.push_back(hashBytes); |
| 152 | return TxoutType::SCRIPTHASH; |
| 153 | } |
| 154 | |
| 155 | int witnessversion; |
| 156 | std::vector<unsigned char> witnessprogram; |
| 157 | if (scriptPubKey.IsWitnessProgram(witnessversion, witnessprogram)) { |
| 158 | if (witnessversion == 0 && witnessprogram.size() == WITNESS_V0_KEYHASH_SIZE) { |
| 159 | vSolutionsRet.push_back(std::move(witnessprogram)); |
| 160 | return TxoutType::WITNESS_V0_KEYHASH; |
| 161 | } |
| 162 | if (witnessversion == 0 && witnessprogram.size() == WITNESS_V0_SCRIPTHASH_SIZE) { |
| 163 | vSolutionsRet.push_back(std::move(witnessprogram)); |
| 164 | return TxoutType::WITNESS_V0_SCRIPTHASH; |
| 165 | } |
| 166 | if (witnessversion == 1 && witnessprogram.size() == WITNESS_V1_TAPROOT_SIZE) { |
| 167 | vSolutionsRet.push_back(std::move(witnessprogram)); |
| 168 | return TxoutType::WITNESS_V1_TAPROOT; |
| 169 | } |
| 170 | if (witnessversion == 2 && witnessprogram.size() == WITNESS_V2_CISA_SIZE) { |
| 171 | vSolutionsRet.push_back(std::move(witnessprogram)); |
| 172 | return TxoutType::WITNESS_V2_CISA; |
| 173 | } |
| 174 | if (scriptPubKey.IsPayToAnchor()) { |
| 175 | return TxoutType::ANCHOR; |
| 176 | } |
| 177 | if (witnessversion != 0) { |
| 178 | vSolutionsRet.push_back(std::vector<unsigned char>{(unsigned char)witnessversion}); |
| 179 | vSolutionsRet.push_back(std::move(witnessprogram)); |
| 180 | return TxoutType::WITNESS_UNKNOWN; |
| 181 | } |
Listing 5: src/script/descriptor.cpp InferScript (Lines 2857-2896)
| 2857 | if ((txntype == TxoutType::WITNESS_V1_TAPROOT || txntype == TxoutType::WITNESS_V2_CISA) && ctx == ParseScriptContext::TOP) { |
| 2858 | const bool cisa{txntype == TxoutType::WITNESS_V2_CISA}; |
| 2859 | // Extract x-only pubkey from output. |
| 2860 | XOnlyPubKey pubkey; |
| 2861 | std::copy(data[0].begin(), data[0].end(), pubkey.begin()); |
| 2862 | // Request spending data. |
| 2863 | TaprootSpendData tap; |
| 2864 | if (provider.GetTaprootSpendData(pubkey, tap)) { |
| 2865 | // If found, convert it back to tree form. |
| 2866 | auto tree = InferTaprootTree(tap, pubkey); |
| 2867 | if (tree) { |
| 2868 | // If that works, try to infer subdescriptors for all leaves. |
| 2869 | bool ok = true; |
| 2870 | std::vector<std::unique_ptr<DescriptorImpl>> subscripts; //!< list of script subexpressions |
| 2871 | std::vector<int> depths; //!< depth in the tree of each subexpression (same length subscripts) |
| 2872 | for (const auto& [depth, script, leaf_ver] : *tree) { |
| 2873 | std::unique_ptr<DescriptorImpl> subdesc; |
| 2874 | if (leaf_ver == TAPROOT_LEAF_TAPSCRIPT) { |
| 2875 | subdesc = InferScript(CScript(script.begin(), script.end()), ParseScriptContext::P2TR, provider); |
| 2876 | } |
| 2877 | if (!subdesc) { |
| 2878 | ok = false; |
| 2879 | break; |
| 2880 | } else { |
| 2881 | subscripts.push_back(std::move(subdesc)); |
| 2882 | depths.push_back(depth); |
| 2883 | } |
| 2884 | } |
| 2885 | if (ok) { |
| 2886 | auto key = InferXOnlyPubkey(tap.internal_key, ParseScriptContext::P2TR, provider); |
| 2887 | return std::make_unique<TRDescriptor>(std::move(key), std::move(subscripts), std::move(depths), cisa); |
| 2888 | } |
| 2889 | } |
| 2890 | } |
| 2891 | // If the above doesn't work, construct a rawtr() or rawcisa() descriptor with just the encoded x-only pubkey. |
| 2892 | if (pubkey.IsFullyValid()) { |
| 2893 | auto key = InferXOnlyPubkey(pubkey, ParseScriptContext::P2TR, provider); |
| 2894 | if (key) { |
| 2895 | return std::make_unique<RawTRDescriptor>(std::move(key), cisa); |
| 2896 | } |
Listing 6: src/validation.cpp (Lines 2334-2337)
| 2334 | // Enforce witness v2 cross-input signature aggregation (BIP460) |
| 2335 | if (DeploymentActiveAt(block_index, chainman, Consensus::DEPLOYMENT_CISA)) { |
| 2336 | flags |= SCRIPT_VERIFY_WITNESS_V2; |
| 2337 | } |
Listing 7: src/policy/policy.h (Lines 98-111)
| 98 | * Mandatory script verification flags that all new transactions must comply with for |
| 99 | * them to be valid. |
| 100 | * |
| 101 | * Note that this does not affect consensus validity; see GetBlockScriptFlags() |
| 102 | * for that. |
| 103 | */ |
| 104 | inline constexpr script_verify_flags MANDATORY_SCRIPT_VERIFY_FLAGS{SCRIPT_VERIFY_P2SH | |
| 105 | SCRIPT_VERIFY_DERSIG | |
| 106 | SCRIPT_VERIFY_NULLDUMMY | |
| 107 | SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY | |
| 108 | SCRIPT_VERIFY_CHECKSEQUENCEVERIFY | |
| 109 | SCRIPT_VERIFY_WITNESS | |
| 110 | SCRIPT_VERIFY_TAPROOT | |
| 111 | SCRIPT_VERIFY_WITNESS_V2}; |
Proof of concept
- Import or write a cisa() descriptor on this binary. Create a payment to that scriptPubKey on mainnet, testnet, testnet4, or signet. Solver returns WITNESS_V2_CISA. InferScript returns cisa() or rawcisa(). The output is standard, as WITNESS_UNKNOWN outputs already are on master.
- Mine the payment. GetBlockScriptFlags does not set SCRIPT_VERIFY_WITNESS_V2 on those chains.
- Spend with an empty witness or a random 64-byte witness. VerifyWitnessProgram hits the v2 branch, sees the flag is off, and returns success before the empty-witness check.
- The spend is consensus-valid. Mempool still runs STANDARD_SCRIPT_VERIFY_FLAGS, so the spend does not relay. A miner can include it. Default wallet receive is still tr, so this path needs a cisa() descriptor.
BVSS
AO:A/AC:L/AX:L/C:N/I:M/A:N/D:M/Y:N/R:N/S:U (6.3)
Recommendation
Keep v2 classified as WITNESS_UNKNOWN, and keep cisa() / rawcisa() out of InferScript, until DEPLOYMENT_CISA is active on that chain. Keep SCRIPT_VERIFY_WITNESS_V2 out of mandatory and standard flags until then. Before merge to master, assign DEPLOYMENT_CISA on mainnet, testnet, testnet4, and signet with a dedicated bit and explicit start/timeout. Drop the redundant SCRIPT_VERIFY_WITNESS_V2 term on STANDARD_SCRIPT_VERIFY_FLAGS. Regtest ALWAYS_ACTIVE can stay for development.
Status
Open in the reviewed tree.
4.3 (HACK-03) PSBT MERGE DOES NOT REJECT CONFLICTING HALF-AGGREGATION SIGNATURES
Medium (6.3)BIP460PSBT / combinerCB-03OPEN
Description
PSBTInput::Merge copies m_cisa_halfagg_sig only when the destination field is empty. CISACompatible conflicts on m_cisa_mode, m_cisa_fullagg_pubnonce, and m_cisa_fullagg_partial_sig. Two different 64-byte half-agg signatures on the same input are treated as compatible. The first value is kept. A combiner can silently drop one signer's half-agg signature. FinalizeCISAInputs then builds the group over mixed BIP340 material. The user believes both signed.
Code location
Listing 8: src/psbt.cpp (Lines 473-487)
| 473 | if (!m_cisa_mode) m_cisa_mode = input.m_cisa_mode; |
| 474 | if (m_cisa_halfagg_sig.empty()) m_cisa_halfagg_sig = input.m_cisa_halfagg_sig; |
| 475 | if (m_cisa_fullagg_pubnonce.empty()) m_cisa_fullagg_pubnonce = input.m_cisa_fullagg_pubnonce; |
| 476 | if (m_cisa_fullagg_partial_sig.IsNull()) m_cisa_fullagg_partial_sig = input.m_cisa_fullagg_partial_sig; |
| 477 | if (sequence == std::nullopt && input.sequence != std::nullopt) sequence = input.sequence; |
| 478 | if (time_locktime == std::nullopt && input.time_locktime != std::nullopt) time_locktime = input.time_locktime; |
| 479 | if (height_locktime == std::nullopt && input.height_locktime != std::nullopt) height_locktime = input.height_locktime; |
| 480 | } |
| 481 | |
| 482 | bool PSBTInput::CISACompatible(const PSBTInput& input) const |
| 483 | { |
| 484 | if (m_cisa_mode && input.m_cisa_mode && m_cisa_mode != input.m_cisa_mode) return false; |
| 485 | if (!m_cisa_fullagg_pubnonce.empty() && !input.m_cisa_fullagg_pubnonce.empty() && m_cisa_fullagg_pubnonce != input.m_cisa_fullagg_pubnonce) return false; |
| 486 | return m_cisa_fullagg_partial_sig.IsNull() || input.m_cisa_fullagg_partial_sig.IsNull() || m_cisa_fullagg_partial_sig == input.m_cisa_fullagg_partial_sig; |
| 487 | } |
Proof of concept
- Build PSBT A for a 2-input half-agg transaction. Set input 0 m_cisa_halfagg_sig to Alice's 64-byte signature.
- Build PSBT B for the same unsigned transaction. Set input 0 m_cisa_halfagg_sig to Bob's 64-byte signature, different bytes from Alice's.
- Merge B into A. CISACompatible returns true. Merge keeps Alice's value because the destination field is already non-empty.
- On this binary,
combinepsbt([A, B]) succeeds and keeps A's signature. combinepsbt([B, A]) keeps B's. wallet_cisa.py already rejects a conflicting full-agg nonce with PSBTs not compatible. Half-agg signatures have no such check.
BVSS
AO:A/AC:L/AX:L/C:N/I:M/A:M/D:N/Y:N/R:N/S:U (6.3)
Recommendation
Treat m_cisa_halfagg_sig like the full-agg partial sig in CISACompatible: if both are present and unequal, return false.
Status
Open in the reviewed tree.
4.4 (HACK-04) FINALIZECISAINPUTS SKIPS ALREADY-SIGNED MEMBERS AND CAN EMIT A SECOND GROUP
Medium (5.7)BIP460PSBT / finalizerCB-04OPEN
Description
FinalizeCISAInputs walks inputs with a given marker and continues past any PSBTInputSigned input. Consensus VerifyCISATransaction collects every marked keypath in input order and rejects a member after final_seen. If a later same-mode input is missing a signature, the walk aborts and writes nothing. If input 0 already has a 1-input final witness and input 1 is then marked half-agg with a signature, the loop skips input 0 and writes a new 1-input final on input 1. Two finals of the same mode. Validation returns SCRIPT_ERR_CISA_GROUP_INVALID. The extracted transaction cannot be mined.
Code location
Listing 9: src/psbt.cpp (Lines 844-860)
| 844 | void FinalizeCISAInputs(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata) |
| 845 | { |
| 846 | std::optional<CMutableTransaction> unsigned_tx = psbt.GetUnsignedTx(); |
| 847 | if (!unsigned_tx || !txdata.m_spent_outputs_ready) return; |
| 848 | |
| 849 | for (const uint8_t marker : {CISA_MARKER_HALFAGG, CISA_MARKER_FULLAGG}) { |
| 850 | std::vector<PSBTInput*> group; |
| 851 | std::vector<XOnlyPubKey> pubkeys; |
| 852 | std::vector<uint256> msgs; |
| 853 | std::vector<uint8_t> sighash_types; |
| 854 | std::vector<std::vector<uint8_t>> sigs; // 64-byte signatures for half-agg, pubnonces for full-agg |
| 855 | std::vector<uint256> partial_sigs; |
| 856 | bool complete{true}; |
| 857 | for (size_t i = 0; i < psbt.inputs.size() && complete; ++i) { |
| 858 | PSBTInput& input = psbt.inputs[i]; |
| 859 | if (input.m_cisa_mode != marker || PSBTInputSigned(input)) continue; |
| 860 | CTxOut utxo; |
Listing 10: src/script/interpreter.cpp (Lines 2249-2254)
| 2249 | AggGroup& group = *parsed->marker == CISA_MARKER_HALFAGG ? halfagg : fullagg; |
| 2250 | // No group members are allowed after the group's final input |
| 2251 | if (group.final_seen) return set_error(serror, SCRIPT_ERR_CISA_GROUP_INVALID); |
| 2252 | group.inputs.push_back({i, parsed->sighash_type, XOnlyPubKey{witprog}, has_annex, annex_hash}); |
| 2253 | group.aggsig.insert(group.aggsig.end(), parsed->signature.begin(), parsed->signature.end()); |
| 2254 | group.final_seen = parsed->is_final; |
Proof of concept
- Build a 2-input half-agg PSBT and sign both inputs without finalizing.
- Clear input 1's cisa_mode and half-agg signature. Finalize. Input 0 gets a 65-byte 1-input final. Leaving input 1 in half-agg mode without a signature makes FinalizeCISAInputs abort the group and write nothing.
- Restore input 1's mode and signature. Finalize again. The loop skips input 0 because PSBTInputSigned is true, and writes a second 65-byte final on input 1. finalizepsbt reports complete=true.
- On this binary,
testmempoolaccept rejects with mempool-script-verify-flag-failed (Invalid CISA aggregation group structure).
BVSS
AO:A/AC:L/AX:L/C:N/I:L/A:M/D:N/Y:N/R:N/S:U (5.7)
Recommendation
Do not skip PSBTInputSigned members of the same mode. Parse an existing CISA witness back into the group, or refuse to finalize when any member already has a final witness that is not this group's witness.
Status
Open in the reviewed tree.
4.5 (HACK-05) HIDINGSIGNINGPROVIDER EXPOSES FULL-AGGREGATION SECNONCES
Medium (5.0)BIP460Wallet / secretsCB-07OPEN
Description
GetKey on HidingSigningProvider returns false when m_hide_secret is set. SetCISASecNonce, GetCISASecNonce, and DeleteCISASession always forward to the inner provider. SignPSBTInput constructs HidingSigningProvider(keys, hide_secret=!options.sign, ...). The updater path (options.sign false) therefore still reads, overwrites, or deletes a DahLIAS secnonce. The header on FullAggSecNonce states that reusing a secnonce leaks the private key. CreateFullAggPartialSig invalidates the nonce after every Sign call.
CreateCISAFullAggPartialSig also needs GetKeyByXOnly, which hiding blocks, so the current sign path does not complete through a hiding provider. The updater API still hands the secret out. Delete under a concurrent signer burns the session. A copy of the nonce plus a second Sign is a key leak if a caller uses GetCISASecNonce on that hiding provider.
Code location
Listing 11: src/wallet/scriptpubkeyman.cpp (Lines 1453-1456)
| 1453 | const auto sign_result = SignPSBTInput(HidingSigningProvider(keys.get(), /*hide_secret=*/!options.sign, /*hide_origin=*/!options.bip32_derivs), psbtx, i, &txdata, options, /*out_sigdata=*/nullptr); |
| 1454 | if (!sign_result.has_value() && sign_result.error() != PSBTError::INCOMPLETE) { |
| 1455 | return sign_result.error(); |
| 1456 | } |
Listing 12: src/script/signingprovider.cpp (Lines 42-46)
| 42 | bool HidingSigningProvider::GetKey(const CKeyID& keyid, CKey& key) const |
| 43 | { |
| 44 | if (m_hide_secret) return false; |
| 45 | return m_provider->GetKey(keyid, key); |
| 46 | } |
Listing 13: src/script/signingprovider.cpp (Lines 88-101)
| 88 | void HidingSigningProvider::SetCISASecNonce(const uint256& id, FullAggSecNonce&& nonce) const |
| 89 | { |
| 90 | m_provider->SetCISASecNonce(id, std::move(nonce)); |
| 91 | } |
| 92 | |
| 93 | std::optional<std::reference_wrapper<FullAggSecNonce>> HidingSigningProvider::GetCISASecNonce(const uint256& session_id) const |
| 94 | { |
| 95 | return m_provider->GetCISASecNonce(session_id); |
| 96 | } |
| 97 | |
| 98 | void HidingSigningProvider::DeleteCISASession(const uint256& session_id) const |
| 99 | { |
| 100 | m_provider->DeleteCISASession(session_id); |
| 101 | } |
Proof of concept
- Construct a PSBT updater call with options.sign false. SignPSBTInput wraps the provider in HidingSigningProvider with hide_secret true.
- Call GetCISASecNonce on that hiding provider with a live session id. The call forwards to the inner provider and returns a FullAggSecNonce whose Get() yields a mutable secp256k1_fullagg_secnonce*.
- Copy that nonce and Sign a second time, or DeleteCISASession while another signer is in CreateFullAggPartialSig. The first is a key leak if Sign runs twice on the same nonce. The second burns the session.
BVSS
AO:A/AC:L/AX:L/C:M/I:N/A:N/D:N/Y:N/R:N/S:U (5.0)
Recommendation
Gate Get, Set, and Delete CISA secnonce on !m_hide_secret, matching GetKey. Make FullAggSecNonce::Get() non-const.
Status
Open in the reviewed tree.
4.6 (HACK-06) CISACHECK NEVER USES THE SIGNATURE CACHE
Low (2.5)BIP460Validation / cacheCB-05OPEN
Description
CScriptCheck::operator() verifies through CachingTransactionSignatureChecker and the ValidationCache signature cache. CISACheck::operator() calls VerifyCISATransaction with no SignatureCache. The CISACheck constructor stores only the transaction, spent outputs, flags, and precomputed txdata. Reconnect of a block that missed the script-execution cache repeats the full aggregate EC verify. Complexity stays O(n) in the number of aggregated inputs, the same order as n Schnorr checks, without a signature-cache hit on (aggsig, pubkeys, msgs).
Code location
Listing 14: src/validation.cpp (Lines 2013-2032)
| 2013 | std::optional<std::pair<ScriptError, std::string>> CScriptCheck::operator()() { |
| 2014 | const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; |
| 2015 | const CScriptWitness *witness = &ptxTo->vin[nIn].scriptWitness; |
| 2016 | ScriptError error{SCRIPT_ERR_UNKNOWN_ERROR}; |
| 2017 | if (VerifyScript(scriptSig, m_tx_out.scriptPubKey, witness, m_flags, CachingTransactionSignatureChecker(ptxTo, nIn, m_tx_out.nValue, cacheStore, *m_signature_cache, *txdata), &error)) { |
| 2018 | return std::nullopt; |
| 2019 | } else { |
| 2020 | auto debug_str = strprintf("input %i of %s (wtxid %s), spending %s:%i", nIn, ptxTo->GetHash().ToString(), ptxTo->GetWitnessHash().ToString(), ptxTo->vin[nIn].prevout.hash.ToString(), ptxTo->vin[nIn].prevout.n); |
| 2021 | return std::make_pair(error, std::move(debug_str)); |
| 2022 | } |
| 2023 | } |
| 2024 | |
| 2025 | std::optional<std::pair<ScriptError, std::string>> CISACheck::operator()() |
| 2026 | { |
| 2027 | ScriptError error{SCRIPT_ERR_UNKNOWN_ERROR}; |
| 2028 | if (VerifyCISATransaction(*m_tx, *m_spent_outputs, m_flags, *m_txdata, &error)) { |
| 2029 | return std::nullopt; |
| 2030 | } |
| 2031 | auto debug_str = strprintf("CISA aggregate verification of %s (wtxid %s)", m_tx->GetHash().ToString(), m_tx->GetWitnessHash().ToString()); |
| 2032 | return std::make_pair(error, std::move(debug_str)); |
Listing 15: src/validation.h (Lines 365-375)
| 365 | class CISACheck |
| 366 | { |
| 367 | private: |
| 368 | const CTransaction* m_tx; |
| 369 | const std::vector<CTxOut>* m_spent_outputs; |
| 370 | script_verify_flags m_flags; |
| 371 | const PrecomputedTransactionData* m_txdata; |
| 372 | |
| 373 | public: |
| 374 | CISACheck(const CTransaction& tx, const std::vector<CTxOut>& spent_outputs, script_verify_flags flags, const PrecomputedTransactionData& txdata) |
| 375 | : m_tx(&tx), m_spent_outputs(&spent_outputs), m_flags(flags), m_txdata(&txdata) {} |
BVSS
AO:A/AC:L/AX:L/C:N/I:N/A:L/D:N/Y:N/R:N/S:U (2.5)
Recommendation
Key aggregate verifies through the signature cache on (aggsig, pubkeys, msgs), matching CScriptCheck.
Status
Open in the reviewed tree.
4.7 (HACK-07) SIGHASH_SINGLE AND HASHTYPE FAILURES ARE REPORTED AS CISA AGGREGATE-VERIFY FAILURES
Low (2.5)BIP460Witness / errorsCB-06OPEN
Description
verify_group in VerifyCISATransaction returns false when SignatureHashSchnorr fails, then the caller sets SCRIPT_ERR_CISA_VERIFY_FAILED. SignatureHashSchnorr fails for SIGHASH_SINGLE when in_pos >= vout.size() and for a bad hash_type. Taproot maps the same failure to SCRIPT_ERR_SCHNORR_SIG_HASHTYPE. ParseCISAWitness already rejects bad explicit sighash bytes, so the remaining case is SIGHASH_SINGLE with no matching output. The transaction is still invalid. RPC reject reasons and tests that match on CISA aggregate signature verification failed hide a sighash-single bug.
Code location
Listing 16: src/script/interpreter.cpp (Lines 2261-2287)
| 2261 | // Pass 3: compute the signature messages and verify the aggregate signatures |
| 2262 | const auto verify_group = [&](const AggGroup& group, uint8_t marker) { |
| 2263 | const size_t n = group.inputs.size(); |
| 2264 | std::vector<XOnlyPubKey> pubkeys(n); |
| 2265 | std::vector<uint256> msgs(n); |
| 2266 | for (size_t j = 0; j < n; j++) { |
| 2267 | const AggInputInfo& info = group.inputs[j]; |
| 2268 | pubkeys[j] = info.pubkey; |
| 2269 | ScriptExecutionData execdata; |
| 2270 | execdata.m_annex_init = true; |
| 2271 | execdata.m_annex_present = info.has_annex; |
| 2272 | if (info.has_annex) execdata.m_annex_hash = info.annex_hash; |
| 2273 | execdata.m_cisa_agg_mode = marker; |
| 2274 | if (!SignatureHashSchnorr(msgs[j], execdata, tx, info.input_index, info.sighash_type, |
| 2275 | SigVersion::WITNESS_V2_KEYPATH, txdata, MissingDataBehavior::FAIL)) { |
| 2276 | return false; |
| 2277 | } |
| 2278 | } |
| 2279 | if (marker == CISA_MARKER_HALFAGG) return VerifyHalfAggSchnorr(pubkeys, msgs, group.aggsig); |
| 2280 | return VerifyFullAggSchnorr(pubkeys, msgs, group.aggsig); |
| 2281 | }; |
| 2282 | |
| 2283 | if (!halfagg.inputs.empty() && !verify_group(halfagg, CISA_MARKER_HALFAGG)) { |
| 2284 | return set_error(serror, SCRIPT_ERR_CISA_VERIFY_FAILED); |
| 2285 | } |
| 2286 | if (!fullagg.inputs.empty() && !verify_group(fullagg, CISA_MARKER_FULLAGG)) { |
| 2287 | return set_error(serror, SCRIPT_ERR_CISA_VERIFY_FAILED); |
BVSS
AO:A/AC:L/AX:L/C:N/I:L/A:N/D:N/Y:N/R:N/S:U (2.5)
Recommendation
If SignatureHashSchnorr fails, set SCRIPT_ERR_WITNESS_V2_INVALID_SIGHASH. Use SCRIPT_ERR_CISA_VERIFY_FAILED only when VerifyHalfAggSchnorr or VerifyFullAggSchnorr returns false.
Status
Open in the reviewed tree.
4.8 (HACK-08) CISAWITNESS DOCUMENTS THAT OPT-OUT SIGHASH IS NOT EXTRACTED, THEN ALWAYS STORES SIGHASH_DEFAULT
Informational (0.0)BIP460Witness / commentsCB-08OPEN
Description
The CISAWitness comment says sighash_type is SIGHASH_DEFAULT unless an explicit sighash byte is present, and that opt-out inputs do not extract the sighash byte. ParseCISAWitness returns sighash_type=SIGHASH_DEFAULT for every 64-byte or non-marker 65-byte element, including a 65-byte BIP341 signature whose last byte is a real hashtype. VerifyCISATransaction skips opt-out inputs, so consensus does not read that field today. A later patch that uses CISAWitness::sighash_type for an opt-out input hashes the wrong message.
Code location
Listing 17: src/script/interpreter.h (Lines 394-408)
| 394 | /** A parsed witness v2 keypath witness element (BIP460). */ |
| 395 | struct CISAWitness { |
| 396 | //! Marker of the input's group (CISA_MARKER_HALFAGG/FULLAGG), std::nullopt |
| 397 | //! for opted-out inputs. Only final inputs carry the marker byte, members |
| 398 | //! are classified by element length. |
| 399 | std::optional<uint8_t> marker; |
| 400 | bool is_final; |
| 401 | //! SIGHASH_DEFAULT unless an explicit sighash byte is present. Not |
| 402 | //! extracted for opted-out inputs: their sighash byte stays part of the |
| 403 | //! signature and is interpreted by the BIP341 rules. |
| 404 | uint8_t sighash_type; |
| 405 | //! Signature data of an aggregated input, entire BIP341 signature of an |
| 406 | //! opted-out input. Points into the element passed to ParseCISAWitness(). |
| 407 | std::span<const unsigned char> signature; |
| 408 | }; |
Listing 18: src/script/interpreter.cpp (Lines 1945-1949)
| 1945 | std::optional<CISAWitness> ParseCISAWitness(std::span<const unsigned char> elem, ScriptError* serror) |
| 1946 | { |
| 1947 | // Opted-out inputs carry a plain BIP341 signature. |
| 1948 | if (elem.size() == 64 || (elem.size() == 65 && elem.back() != CISA_MARKER_HALFAGG && elem.back() != CISA_MARKER_FULLAGG)) { |
| 1949 | return CISAWitness{/*marker=*/std::nullopt, /*is_final=*/false, /*sighash_type=*/SIGHASH_DEFAULT, /*signature=*/elem}; |
BVSS
AO:A/AC:L/AX:L/C:N/I:N/A:N/D:N/Y:N/R:N/S:U (0.0)
Recommendation
Set sighash_type from elem.back() when size is 65, or store std::optional and leave it empty for opt-out so it cannot be used.
Status
Open in the reviewed tree.
4.9 (HACK-09) CHECKINPUTSCRIPTS UNDER-RESERVES THE CHECK QUEUE BY ONE
Informational (0.0)BIP460Validation / queueCB-05bOPEN
Description
When pvChecks is non-null, CheckInputScripts reserves tx.vin.size() then emplaces one CISACheck plus n CScriptChecks. The vector reallocates once on the parallel check path for every CISA transaction. The extra copy is one ValidationCheck.
Code location
Listing 19: src/validation.cpp (Lines 2098-2100)
| 2098 | if (pvChecks) { |
| 2099 | pvChecks->reserve(tx.vin.size()); |
| 2100 | } |
Listing 20: src/validation.cpp (Lines 2133-2136)
| 2133 | if ((flags & SCRIPT_VERIFY_WITNESS_V2) && SpendsAggregatedWitnessV2Inputs(tx, txdata)) { |
| 2134 | CISACheck check(tx, txdata.m_spent_outputs, flags, txdata); |
| 2135 | if (pvChecks) { |
| 2136 | pvChecks->emplace_back(std::move(check)); |
BVSS
AO:A/AC:L/AX:L/C:N/I:N/A:N/D:N/Y:N/R:N/S:U (0.0)
Recommendation
Reserve tx.vin.size()+1 when the CISA check will be queued.
Status
Open in the reviewed tree.
4.10 (HACK-10) CORE VENDORS UNMERGED SECP256K1 HALFAGG AND FULLAGG MODULES
Informational (0.0)BIP460DependenciesCB-09OPEN
Description
The PR squashes bitcoin-core/secp256k1#1566 (halfagg) and #1754 (fullagg) into src/secp256k1, including a musig session_impl refactor into nonce_common. Those PRs are unmerged on the secp256k1 repository. Core consensus verify calls secp256k1_schnorrsig_aggverify from VerifyHalfAggSchnorr and secp256k1_fullagg_verify from VerifyFullAggSchnorr in pubkey.cpp. A later secp rebase can change consensus bytes. Musig nonce sharing can regress existing MuSig2 signing.
Code location
Listing 21: src/pubkey.cpp (Lines 246-268)
| 246 | bool VerifyHalfAggSchnorr(const std::vector<XOnlyPubKey>& pubkeys, const std::vector<uint256>& msgs, std::span<const unsigned char> aggsig) |
| 247 | { |
| 248 | assert(pubkeys.size() == msgs.size()); |
| 249 | const size_t n = pubkeys.size(); |
| 250 | if (n == 0 || aggsig.size() != (n + 1) * 32) return false; |
| 251 | |
| 252 | std::vector<secp256k1_xonly_pubkey> secp_pubkeys(n); |
| 253 | std::vector<unsigned char> flat_msgs(n * 32); |
| 254 | for (size_t i = 0; i < n; i++) { |
| 255 | if (!secp256k1_xonly_pubkey_parse(secp256k1_context_static, &secp_pubkeys[i], pubkeys[i].data())) { |
| 256 | return false; |
| 257 | } |
| 258 | memcpy(flat_msgs.data() + i * 32, msgs[i].begin(), 32); |
| 259 | } |
| 260 | |
| 261 | return secp256k1_schnorrsig_aggverify( |
| 262 | secp256k1_context_static, |
| 263 | secp_pubkeys.data(), |
| 264 | flat_msgs.data(), |
| 265 | n, |
| 266 | aggsig.data(), |
| 267 | aggsig.size()); |
| 268 | } |
Listing 22: src/pubkey.cpp (Lines 270-293)
| 270 | bool VerifyFullAggSchnorr(const std::vector<XOnlyPubKey>& pubkeys, const std::vector<uint256>& msgs, std::span<const unsigned char> sig64) |
| 271 | { |
| 272 | assert(pubkeys.size() == msgs.size()); |
| 273 | const size_t n = pubkeys.size(); |
| 274 | if (n == 0 || sig64.size() != 64) return false; |
| 275 | |
| 276 | std::vector<secp256k1_xonly_pubkey> secp_pubkeys(n); |
| 277 | std::vector<const secp256k1_xonly_pubkey*> pubkey_ptrs(n); |
| 278 | std::vector<const unsigned char*> msg_ptrs(n); |
| 279 | for (size_t i = 0; i < n; i++) { |
| 280 | if (!secp256k1_xonly_pubkey_parse(secp256k1_context_static, &secp_pubkeys[i], pubkeys[i].data())) { |
| 281 | return false; |
| 282 | } |
| 283 | pubkey_ptrs[i] = &secp_pubkeys[i]; |
| 284 | msg_ptrs[i] = msgs[i].begin(); |
| 285 | } |
| 286 | |
| 287 | return secp256k1_fullagg_verify( |
| 288 | secp256k1_context_static, |
| 289 | sig64.data(), |
| 290 | pubkey_ptrs.data(), |
| 291 | msg_ptrs.data(), |
| 292 | n); |
| 293 | } |
BVSS
AO:A/AC:L/AX:L/C:N/I:N/A:N/D:N/Y:N/R:N/S:U (0.0)
Recommendation
Wait for secp256k1 merge of halfagg and fullagg. Re-review the musig extract against BIP327 tests before bumping the subtree in Core.
Status
Open in the reviewed tree.
4.11 (HACK-11) DEPLOYMENT_CISA DEFAULTS TO TESTDUMMY BIT 28 ON EVERY CHAIN EXCEPT REGTEST
Informational (0.0)BIP460ActivationCB-10OPEN
Description
BIP9Deployment defaults bit to 28 and nStartTime to NEVER_ACTIVE. DEPLOYMENT_TESTDUMMY is also bit 28. Only CRegTestParams assigns DEPLOYMENT_CISA bit 3 and ALWAYS_ACTIVE. ApplyDeploymentOptions can set nStartTime, nTimeout, and min_activation_height for DEPLOYMENT_CISA without assigning a unique bit. Two deployments sharing bit 28 are dormant today. Enabling CISA via version-bits options without setting bit collides with testdummy versionbits state. First-class v2 before those chains have an explicit assignment is HACK-02.
Code location
Listing 23: src/consensus/params.h (Lines 50-56)
| 50 | struct BIP9Deployment { |
| 51 | /** Bit position to select the particular bit in nVersion. */ |
| 52 | int bit{28}; |
| 53 | /** Start MedianTime for version bits miner confirmation. Can be a date in the past */ |
| 54 | int64_t nStartTime{NEVER_ACTIVE}; |
| 55 | /** Timeout/expiry MedianTime for the deployment attempt. */ |
| 56 | int64_t nTimeout{NEVER_ACTIVE}; |
Listing 24: src/kernel/chainparams.cpp (Lines 98-102)
| 98 | for (const auto& [deployment_pos, version_bits_params] : opts.version_bits_parameters) { |
| 99 | consensus.vDeployments[deployment_pos].nStartTime = version_bits_params.start_time; |
| 100 | consensus.vDeployments[deployment_pos].nTimeout = version_bits_params.timeout; |
| 101 | consensus.vDeployments[deployment_pos].min_activation_height = version_bits_params.min_activation_height; |
| 102 | } |
BVSS
AO:A/AC:L/AX:L/C:N/I:N/A:N/D:N/Y:N/R:N/S:U (0.0)
Recommendation
Initialize vDeployments[DEPLOYMENT_CISA] on every chain to NEVER_ACTIVE with an unused bit. Do not share bit 28.
Status
Open in the reviewed tree.
4.12 (HACK-12) CONSENSUS AND THE PSBT FINALIZER ALLOW ONLY ONE HALF-AGG GROUP AND ONE FULL-AGG GROUP PER TRANSACTION
Informational (0.0)BIP460Protocol / groupingCB-11OPEN
Description
VerifyCISATransaction keeps one AggGroup for half-agg and one for full-agg. After final_seen, another member of that mode is SCRIPT_ERR_CISA_GROUP_INVALID. FinalizeCISAInputs likewise collects every input with a given marker into a single group in index order. Two coinjoin batches of the same mode in one transaction are consensus-invalid. Wallets that assume multiple groups will produce txs that fail CISA_GROUP_INVALID.
Code location
See Listing 10 for VerifyCISATransaction final_seen (src/script/interpreter.cpp Lines 2249-2254) and Listing 9 for FinalizeCISAInputs (src/psbt.cpp Lines 844-860).
BVSS
AO:A/AC:L/AX:L/C:N/I:N/A:N/D:N/Y:N/R:N/S:U (0.0)
Recommendation
If BIP460 wants one group per mode, say so in the BIP grouping rules. If multiple groups are required, parse group boundaries from finals instead of a single final_seen flag.
Status
Open in the reviewed tree.
5 Recommendations
Same order as chapter 4, grouped by band. Each row is the change for
that HACK id. Status is OPEN in the reviewed tree.
High
| ID | Risk | Recommendation | Status |
| HACK-01 | High (8.2) | In ProduceSignature and DataFromTransaction, do not set complete from VerifyScript alone when ParseCISAWitness yields a marker. Require VerifyCISATransaction on the full transaction. Leave the per-input set_success for marked keypath as the structure check. | OPEN |
Medium
| ID | Risk | Recommendation | Status |
| HACK-02 | Medium (6.3) | Keep v2 classified as WITNESS_UNKNOWN, and keep cisa() / rawcisa() out of InferScript, until DEPLOYMENT_CISA is active on that chain. Keep SCRIPT_VERIFY_WITNESS_V2 out of mandatory and standard flags until then. Before merge to master, assign DEPLOYMENT_CISA on mainnet, testnet, testnet4, and signet with a dedicated bit and explicit start/timeout. Drop the redundant SCRIPT_VERIFY_WITNESS_V2 term on STANDARD_SCRIPT_VERIFY_FLAGS. Regtest ALWAYS_ACTIVE can stay for development. | OPEN |
| HACK-03 | Medium (6.3) | Treat m_cisa_halfagg_sig like the full-agg partial sig in CISACompatible: if both are present and unequal, return false. | OPEN |
| HACK-04 | Medium (5.7) | Do not skip PSBTInputSigned members of the same mode. Parse an existing CISA witness back into the group, or refuse to finalize when any member already has a final witness that is not this group's witness. | OPEN |
| HACK-05 | Medium (5.0) | Gate Get, Set, and Delete CISA secnonce on !m_hide_secret, matching GetKey. Make FullAggSecNonce::Get() non-const. | OPEN |
Low
| ID | Risk | Recommendation | Status |
| HACK-06 | Low (2.5) | Key aggregate verifies through the signature cache on (aggsig, pubkeys, msgs), matching CScriptCheck. | OPEN |
| HACK-07 | Low (2.5) | If SignatureHashSchnorr fails, set SCRIPT_ERR_WITNESS_V2_INVALID_SIGHASH. Use SCRIPT_ERR_CISA_VERIFY_FAILED only when VerifyHalfAggSchnorr or VerifyFullAggSchnorr returns false. | OPEN |
Informational
| ID | Risk | Recommendation | Status |
| HACK-08 | Informational (0.0) | Set sighash_type from elem.back() when size is 65, or store std::optional and leave it empty for opt-out so it cannot be used. | OPEN |
| HACK-09 | Informational (0.0) | Reserve tx.vin.size()+1 when the CISA check will be queued. | OPEN |
| HACK-10 | Informational (0.0) | Wait for secp256k1 merge of halfagg and fullagg. Re-review the musig extract against BIP327 tests before bumping the subtree in Core. | OPEN |
| HACK-11 | Informational (0.0) | Initialize vDeployments[DEPLOYMENT_CISA] on every chain to NEVER_ACTIVE with an unused bit. Do not share bit 28. | OPEN |
| HACK-12 | Informational (0.0) | If BIP460 wants one group per mode, say so in the BIP grouping rules. If multiple groups are required, parse group boundaries from finals instead of a single final_seen flag. | OPEN |
6 Fuzz testing
No fuzz harness was run for this review. Bitcoin Core's existing
fuzz targets were not executed against the CISA parse or aggregate-verify
paths. ParseCISAWitness length cases and VerifyCISATransaction grouping
were checked by reading interpreter.cpp and by running feature_cisa.py
on a Release build of this commit. That harness passed. It does not
cover ProduceSignature completeness, half-agg PSBT merge, or
FinalizeCISAInputs skipping a signed member. Those three were hit with
RPC probes on the same binary (HACK-01, HACK-03, HACK-04).
7 Static analysis
No static analyzer was run on this tree. Flag placement, completeness
oracles, PSBT merge, nonce hiding, and error codes were checked by
reading the sources and are filed as HACK ids.
8 Remediation record
Report date 15 September 2026. PR 36122 is unmerged. No patch commit was reviewed. This assessment does not include a remediation review.
| Date | IDs | Commit / statement | Independent confirm | Merge |
| 09/15/2026 |
HACK-01 to HACK-12 |
OPEN. Tree unchanged relative to 224e15fd891334f0a2fb924d2ac60bc08ed9e4f3. |
No |
Open |
All 12 findings are open in this tree.
9 Exhibit B
Severity words for this Assessment Report, plus the as-is cap.
Services agreement terms apply when one exists.
All services, the assessment report, work product, or other materials are provided "as is" and "as available" and with all faults and defects without warranty of any kind. To the maximum extent permitted under applicable law, Hackerbane disclaims all warranties, express, implied, or statutory, including merchantability, fitness for a particular purpose, title, and non-infringement. Hackerbane makes no warranty that the services or the report will meet any person's requirements, achieve any intended result, be secure, accurate, complete, free of harmful code, or error-free, or that any error can or will be corrected.
No third party is a beneficiary of this report. This report is not financial, tax, legal, or regulatory advice.
Severity words used in the Report
| Critical | Funds or safety, exploitable as scoped. An attacker with the access the threat model grants can take value or break a safety property now. |
| High | Serious, less immediate than critical. Exploitable with a precondition that is realistic but not free: a specific role, a market state, a second bug. |
| Medium | Bounded loss or a broken assumption that does not yet have an exploit path in scope. Fix before the next release. |
| Low | Defense in depth. No direct loss path today; removes a step from a future one. |
| Informational | An observation with no security impact as scoped. Hygiene, clarity, or a note for the next reviewer. |