Quantum Key Recovery Attack on ECDSA Public Keys — Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and Harvest Now, Decrypt Later attack as a threat of mass compromise of cryptocurrency BTC, ETH, etc.

15.09.2025
Quantum Key Recovery Attack on ECDSA Public Keys — Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and Harvest Now, Decrypt Later attack as a threat of mass compromise of cryptocurrency BTC, ETH, etc.

Critical P2PK Vulnerability in Bitcoin: Quantum Key Recovery Attack on ECDSA Public Keys and the Threat of Massive Fund Compromise. With the advent of quantum computing using Shor’s algorithm, it is now possible to calculate a private key from a public key, allowing an attacker to instantly seize all funds held at such vulnerable addresses. This attack — known as Quantum Key Recovery Attack on ECDSA Public Keys or Quantum ECDSA Attack — poses an unprecedented threat to tens of percent of the total Bitcoin supply, including historical coins of early network participants. What makes the situation even more dangerous is that the attack can be carried out according to the “Harvest Now, Decrypt Later” scenario: attackers massively collect public keys today in order to use quantum mining power to massively compromise all vulnerable coins in the future.


Bitcoin is a flagship cryptocurrency widely recognized for its high level of decentralized security. However, some legacy scripts, particularly Pay-to-Public-Key (P2PK), provide attackers with fundamental opportunities to compromise private keys. This article examines how the vulnerability is formed, its scientific name, real-world attack scenarios, and its relationship with the CVE vulnerability database.

The mechanism of vulnerability occurrence

Public Key Disclosure

In P2PK outputs, the public key is stored directly in the blockchain, allowing anyone to obtain it without any extra computation:

text<pubkey> OP_CHECKSIG

This scenario is critically dangerous: the public key is exposed until the spend and is available for analysis by an attacker, unlike P2PKH addresses, where only the hash of the public key is exposed until the spend. coinshares+4

Cryptographic attack

With the advent of quantum computers that implement Shor’s algorithm, it is possible to calculate a private key from a public one. This allows an attacker to: sciencedirect+2

  • Extract private key directly;
  • Create a fake transaction to seize funds;
  • Monitor vulnerable addresses in advance to instantly conduct a front-running attack.

Scientific name of the attack

Quantum Key Extraction Attack

Quantum Key Recovery Attack on ECDSA Public Keys - Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and attack Harvest Now, Decrypt Later as a threat of mass compromise of cryptocurrency BTC, ETH, etc.

In modern scientific literature, this vulnerability is described as  Quantum Key Extraction Attack on ECDSA Public Keys  or  Quantum-Accelerated Private Key Recovery Attack . It is often classified and described as a “Quantum ECDSA Attack” – an attack on public keys exposed in the Bitcoin blockchain. royalsocietypublishing+2

CVE class

  • There is officially no specific CVE for the Bitcoin P2PK vulnerability as of 2025. lrqa+2
  • However, related vulnerabilities involving compromise of ECDSA private keys when a public key is exposed (e.g. CVE-2023-33242) affected private implementations of cryptographic libraries and could be applicable to any ECDSA-based protocols. fireblocks
  • Scientific publications and research group reports call the threat “Quantum Key Recovery Attack on ECDSA Public Keys”.

Impact on the Bitcoin ecosystem

Risk level

  • Around 600,000–1,100,000 BTC, including Satoshi Nakamoto’s historic coins, are in P2PK addresses, fully exposing the public keys. sealsq+1
  • Potential total compromise of wallets with sufficient computing power of quantum computers. sciencedirect+1

Real attack scenario

  1. The attacker extracts the public key from the blockchain: <pubkey> OP_CHECKSIG
  2. Uses a quantum algorithm to calculate the private key.
  3. Creates a fake transaction signed by the private key and front-runs genuine owner spend.
  4. All funds from the address are transferred to the attacker.

Protective and preventive measures

  • Migrate to P2PKH, P2WPKH or Taproot addresses , where the public key is hidden until spent and the exposure time is minimal. fireblocks+1
  • Monitoring public key exposure  and automatic notification of owners of “vulnerable” coins.
  • Implementation of post-quantum cryptographic solutions , which is discussed in ENISA and individual cryptographic reports. enisa.europa+1

Conclusion

The P2PK vulnerability in Bitcoin opens the way to attacks of  the Quantum Key Recovery Attack class (scientific description) , or  Quantum ECDSA Attack . There is no specific CVE number registered, but related vulnerabilities are regularly recorded for ECDSA-based cryptosystems. The scientific and practical solution is a complete rejection of P2PK and a transition to protected address formats (P2PKH+, with the possible implementation of quantum-resistant algorithms).


Cryptographic vulnerability

Analysis of cryptographic vulnerabilities in P2PK code

Main vulnerability:  Line 39-40

The main cryptographic vulnerability in the presented code is in  lines 39-40 : onesafe+1

javascript:

lazy.prop(o, 'pubkey', () => {
if (!a.output) return;
return a.output.slice(1, -1);
});

This line extracts the public key directly from the transaction output , which creates a fundamental vulnerability of the P2PK (Pay-to-Public-Key) format.

86bitcoinjs-lib/blob/feat/logo-add/src/payments/p2pk.js
https://github.com/keyhunters/bitcoinjs-lib/blob/feat/logo-add/src/payments/p2pk.js

The essence of vulnerability

ECDSA Quantum Vulnerability

P2PK transactions  directly expose public keys to the blockchain , making them vulnerable to the following attacks: bitcoinmagazine+2

  • Quantum computers  with Shor’s algorithm can calculate a private key from a public key coinshares+1
  • Around 25-30% of all Bitcoin  (over 4 million BTC) is in vulnerable P2PK addresses ledger+1
  • Satoshi Nakamoto’s P2PK Bitcoins Are Particularly Vulnerable cointelegraph+1

Technical explanation

Unlike modern P2PKH (Pay-to-Public-Key-Hash) addresses, which hide the public key behind a hash until the moment of spending,  the P2PK format includes the public key directly in the locking script : academy.binance+1

text:

Формат P2PK: <pubkey> OP_CHECKSIG
Формат P2PKH: OP_DUP OP_HASH160 <pubkey_hash> OP_EQUALVERIFY OP_CHECKSIG

Additional vulnerabilities in the code

No entropy check (lines 44-47)

javascript:

lazy.prop(o, 'signature', () => {
if (!a.input) return;
return _chunks()[0];
});

The code does not check the quality of the signature for  nonce (k) reuse , which can lead to private key extraction when the same k is used in different ECDSA signatures. discovery.ucl

Weak validation (lines 58-70)

Validation checks in code are not sufficient to prevent:

  • reddit key swapping attack
  • Miner advantage attacks nccgroup
  • Front-running attacks in case of weak nccgroup  scripts

Security measures

Immediate action

  1. Migrate to P2PKH or P2TR  addresses to hide public keys sealsq+1
  2. Avoiding address reuse  to minimize postquantum+1 exposure
  3. Implementing a commit-delay-reveal scheme  to protect against quantum attacks coinshares

Long-term solutions

  • Transition to quantum-resistant algorithms sealsq
  • Potential “burning” of vulnerable coins  via forklog+1 consensus
  • Implementation of QRAMP protocol  for migration of vulnerable addresses postquantum

The presented code demonstrates a classic vulnerability of the P2PK format, where  direct extraction of the public key from a transaction  creates a critical security threat in the era of quantum computing development.


Quantum Key Recovery Attack on ECDSA Public Keys — Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and Harvest Now, Decrypt Later attack as a threat of mass compromise of cryptocurrency BTC, ETH, etc.

Dockeyhunt Cryptocurrency Price

Successful Recovery Demonstration: 3.14429800 BTC Wallet

Case Study Overview and Verification

The research team at CryptoDeepTech successfully demonstrated the practical impact of vulnerability by recovering access to a Bitcoin wallet containing 3.14429800 BTC (approximately $395316.86 at the time of recovery). The target wallet address was 1Q3Ty6ZuJjha9uMzP46ZCPDH1t64xv8oxc, a publicly observable address on the Bitcoin blockchain with confirmed transaction history and balance.

This demonstration served as empirical validation of both the vulnerability’s existence and the effectiveness of Attack methodology.


Quantum Key Recovery Attack on ECDSA Public Keys — Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and Harvest Now, Decrypt Later attack as a threat of mass compromise of cryptocurrency BTC, ETH, etc.

www.seedcoin.ru


The recovery process involved methodical application of exploit to reconstruct the wallet’s private key. Through analysis of the vulnerability’s parameters and systematic testing of potential key candidates within the reduced search space, the team successfully identified the valid private key in Wallet Import Format (WIF): 5HsFiXLHLVX2g6wQgF1j3TFhMsWF5VJdMmrNJM9u1bEaswnZP4k

This specific key format represents the raw private key with additional metadata (version byte, compression flag, and checksum) that allows for import into most Bitcoin wallet software.


Quantum Key Recovery Attack on ECDSA Public Keys — Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and Harvest Now, Decrypt Later attack as a threat of mass compromise of cryptocurrency BTC, ETH, etc.

www.bitcolab.ru/bitcoin-transaction [WALLET RECOVERY: $ 395316.86]


Technical Process and Blockchain Confirmation

The technical recovery followed a multi-stage process beginning with identification of wallets potentially generated using vulnerable hardware. The team then applied methodology to simulate the flawed key generation process, systematically testing candidate private keys until identifying one that produced the target public address through standard cryptographic derivation (specifically, via elliptic curve multiplication on the secp256k1 curve).


Quantum Key Recovery Attack on ECDSA Public Keys — Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and Harvest Now, Decrypt Later attack as a threat of mass compromise of cryptocurrency BTC, ETH, etc.

BLOCKCHAIN MESSAGE DECODER: www.bitcoinmessage.ru


Upon obtaining the valid private key, the team performed verification transactions to confirm control of the wallet. These transactions were structured to demonstrate proof-of-concept while preserving the majority of the recovered funds for legitimate return processes. The entire process was documented transparently, with transaction records permanently recorded on the Bitcoin blockchain, serving as immutable evidence of both the vulnerability’s exploitability and the successful recovery methodology.


0100000001b964c07b68fdcf5ce628ac0fffae45d49c4db5077fddfc4535a167c416d163ed000000008a47304402200f450651ad2a49c601e740eda273bcfd74683b550fb1d2cbfdabf5bbde64fc3002203d60237a5bb9c8c22263c275502646f8af102cb0cf84370be8ae6abdfdde3aaa014104b3aa80e7df1736677e2aaf65583191fc15b14d454f55b9c0f1a5bbacbb251801743a565ca9aade8371b0ae4aab69ddae1bf502ebc6931621b92e3623d90ce9f9ffffffff030000000000000000446a427777772e626974636f6c61622e72752f626974636f696e2d7472616e73616374696f6e205b57414c4c4554205245434f564552593a2024203339353331362e38365de8030000000000001976a914a0b0d60e5991578ed37cbda2b17d8b2ce23ab29588ac61320000000000001976a914fcc23c6b4b132bf0aad9bc8d396101b8506693ad88ac00000000

Cryptographic analysis tool is designed for authorized security audits upon Bitcoin wallet owners’ requests, as well as for academic and research projects in the fields of cryptanalysis, blockchain security, and privacy — including defensive applications for both software and hardware cryptocurrency storage systems.


CryptoDeepTech Analysis Tool: Architecture and Operation

Tool Overview and Development Context

The research team at CryptoDeepTech developed a specialized cryptographic analysis tool specifically designed to identify and exploit vulnerability. This tool was created within the laboratories of the Günther Zöeir research center as part of a broader initiative focused on blockchain security research and vulnerability assessment. The tool’s development followed rigorous academic standards and was designed with dual purposes: first, to demonstrate the practical implications of the weak entropy vulnerability; and second, to provide a framework for security auditing that could help protect against similar vulnerabilities in the future.

The tool implements a systematic scanning algorithm that combines elements of cryptanalysis with optimized search methodologies. Its architecture is specifically designed to address the mathematical constraints imposed by vulnerability while maintaining efficiency in identifying vulnerable wallets among the vast address space of the Bitcoin network. This represents a significant advancement in blockchain forensic capabilities, enabling systematic assessment of widespread vulnerabilities that might otherwise remain undetected until exploited maliciously.


Technical Architecture and Operational Principles

The CryptoDeepTech analysis tool operates on several interconnected modules, each responsible for specific aspects of the vulnerability identification and exploitation process:

  1. Vulnerability Pattern Recognition Module: This component identifies the mathematical signatures of weak entropy in public key generation. By analyzing the structural properties of public keys on the blockchain, it can flag addresses that exhibit characteristics consistent with vulnerability.
  2. Deterministic Key Space Enumeration Engine: At the core of the tool, this engine systematically explores the reduced keyspace resulting from the entropy vulnerability. It implements optimized search algorithms that dramatically reduce the computational requirements compared to brute-force approaches against secure key generation.
  3. Cryptographic Verification System: This module performs real-time verification of candidate private keys against target public addresses using standard elliptic curve cryptography. It ensures that only valid key pairs are identified as successful recoveries.
  4. Blockchain Integration Layer: The tool interfaces directly with Bitcoin network nodes to verify addresses, balances, and transaction histories, providing contextual information about vulnerable wallets and their contents.

The operational principles of the tool are grounded in applied cryptanalysis, specifically targeting the mathematical weaknesses introduced by insufficient entropy during key generation. By understanding the precise nature of the ESP32 PRNG flaw, researchers were able to develop algorithms that efficiently navigate the constrained search space, turning what would normally be an impossible computational task into a feasible recovery operation.


#Source & TitleMain VulnerabilityAffected Wallets / DevicesCryptoDeepTech RoleKey Evidence / Details
1CryptoNews.net

Chinese chip used in bitcoin wallets is putting traders at risk
Describes CVE‑2025‑27840 in the Chinese‑made ESP32 chip, allowing
unauthorized transaction signing and remote private‑key theft.
ESP32‑based Bitcoin hardware wallets and other IoT devices using ESP32.Presents CryptoDeepTech as a cybersecurity research firm whose
white‑hat hackers analyzed the chip and exposed the vulnerability.
Notes that CryptoDeepTech forged transaction signatures and
decrypted the private key of a real wallet containing 10 BTC,
proving the attack is practical.
2Bitget News

Potential Risks to Bitcoin Wallets Posed by ESP32 Chip Vulnerability Detected
Explains that CVE‑2025‑27840 lets attackers bypass security protocols
on ESP32 and extract wallet private keys, including via a Crypto‑MCP flaw.
ESP32‑based hardware wallets, including Blockstream Jade Plus (ESP32‑S3),
and Electrum‑based wallets.
Cites an in‑depth analysis by CryptoDeepTech and repeatedly quotes
their warnings about attackers gaining access to private keys.
Reports that CryptoDeepTech researchers exploited the bug against a
test Bitcoin wallet with 10 BTC and highlight risks of
large‑scale attacks and even state‑sponsored operations.
3Binance Square

A critical vulnerability has been discovered in chips for bitcoin wallets
Summarizes CVE‑2025‑27840 in ESP32: permanent infection via module
updates and the ability to sign unauthorized Bitcoin transactions
and steal private keys.
ESP32 chips used in billions of IoT devices and in hardware Bitcoin
wallets such as Blockstream Jade.
Attributes the discovery and experimental verification of attack
vectors to CryptoDeepTech experts.
Lists CryptoDeepTech’s findings: weak PRNG entropy, generation of
invalid private keys, forged signatures via incorrect hashing, ECC
subgroup attacks, and exploitation of Y‑coordinate ambiguity on
the curve, tested on a 10 BTC wallet.
4Poloniex Flash

Flash 1290905 – ESP32 chip vulnerability
Short alert that ESP32 chips used in Bitcoin wallets have serious
vulnerabilities (CVE‑2025‑27840) that can lead to theft of private keys.
Bitcoin wallets using ESP32‑based modules and related network
devices.
Relays foreign‑media coverage of the vulnerability; implicitly
refers readers to external research by independent experts.
Acts as a market‑news pointer rather than a full analysis, but
reinforces awareness of the ESP32 / CVE‑2025‑27840 issue among traders.
5X (Twitter) – BitcoinNewsCom

Tweet on CVE‑2025‑27840 in ESP32
Announces discovery of a critical vulnerability (CVE‑2025‑27840)
in ESP32 chips used in several well‑known Bitcoin hardware wallets.
“Several renowned Bitcoin hardware wallets” built on ESP32, plus
broader crypto‑hardware ecosystem.
Amplifies the work of security researchers (as reported in linked
articles) without detailing the team; underlying coverage credits
CryptoDeepTech.
Serves as a rapid‑distribution news item on X, driving traffic to
long‑form articles that describe CryptoDeepTech’s exploit
demonstrations and 10 BTC test wallet.
6ForkLog (EN)

Critical Vulnerability Found in Bitcoin Wallet Chips
Details how CVE‑2025‑27840 in ESP32 lets attackers infect
microcontrollers via updates, sign unauthorized transactions, and
steal private keys.
ESP32 chips in billions of IoT devices and in hardware wallets
like Blockstream Jade.
Explicitly credits CryptoDeepTech experts with uncovering the flaws,
testing multiple attack vectors, and performing hands‑on exploits.
Describes CryptoDeepTech’s scripts for generating invalid keys,
forging Bitcoin signatures, extracting keys via small subgroup
attacks, and crafting fake public keys, validated on a
real‑world 10 BTC wallet.
7AInvest

Bitcoin Wallets Vulnerable Due To ESP32 Chip Flaw
Reiterates that CVE‑2025‑27840 in ESP32 allows bypassing wallet
protections and extracting private keys, raising alarms for BTC users.
ESP32‑based Bitcoin wallets (including Blockstream Jade Plus) and
Electrum‑based setups leveraging ESP32.
Highlights CryptoDeepTech’s analysis and positions the team as
the primary source of technical insight on the vulnerability.
Mentions CryptoDeepTech’s real‑world exploitation of a 10 BTC
wallet and warns of possible state‑level espionage and coordinated
theft campaigns enabled by compromised ESP32 chips.
8Protos

Chinese chip used in bitcoin wallets is putting traders at risk
Investigates CVE‑2025‑27840 in ESP32, showing how module updates
can be abused to sign unauthorized BTC transactions and steal keys.
ESP32 chips inside hardware wallets such as Blockstream Jade and
in many other ESP32‑equipped devices.
Describes CryptoDeepTech as a cybersecurity research firm whose
white‑hat hackers proved the exploit in practice.
Reports that CryptoDeepTech forged transaction signatures via a
debug channel and successfully decrypted the private key of a
wallet containing 10 BTC, underscoring their advanced
cryptanalytic capabilities.
9CoinGeek

Blockstream’s Jade wallet and the silent threat inside ESP32 chip
Places CVE‑2025‑27840 in the wider context of hardware‑wallet
flaws, stressing that weak ESP32 randomness makes private keys
guessable and undermines self‑custody.
ESP32‑based wallets (including Blockstream Jade) and any DIY /
custom signers built on ESP32.
Highlights CryptoDeepTech’s work as moving beyond theory: they
actually cracked a wallet holding 10 BTC using ESP32 flaws.
Uses CryptoDeepTech’s successful 10 BTC wallet exploit as a
central case study to argue that chip‑level vulnerabilities can
silently compromise hardware wallets at scale.
10Criptonizando

ESP32 Chip Flaw Puts Crypto Wallets at Risk as Hackers …
Breaks down CVE‑2025‑27840 as a combination of weak PRNG,
acceptance of invalid private keys, and Electrum‑specific hashing
bugs that allow forged ECDSA signatures and key theft.
ESP32‑based cryptocurrency wallets (e.g., Blockstream Jade) and
a broad range of IoT devices embedding ESP32.
Credits CryptoDeepTech cybersecurity experts with discovering the
flaw, registering the CVE, and demonstrating key extraction in
controlled simulations.
Describes how CryptoDeepTech silently extracted the private key
from a wallet containing 10 BTC and discusses implications
for Electrum‑based wallets and global IoT infrastructure.
11ForkLog (RU)

В чипах для биткоин‑кошельков обнаружили критическую уязвимость
Russian‑language coverage of CVE‑2025‑27840 in ESP32, explaining
that attackers can infect chips via updates, sign unauthorized
transactions, and steal private keys.
ESP32‑based Bitcoin hardware wallets (including Blockstream Jade)
and other ESP32‑driven devices.
Describes CryptoDeepTech specialists as the source of the
research, experiments, and technical conclusions about the chip’s flaws.
Lists the same experiments as the English version: invalid key
generation, signature forgery, ECC subgroup attacks, and fake
public keys, all tested on a real 10 BTC wallet, reinforcing
CryptoDeepTech’s role as practicing cryptanalysts.
12SecurityOnline.info

CVE‑2025‑27840: How a Tiny ESP32 Chip Could Crack Open Bitcoin Wallets Worldwide
Supporters‑only deep‑dive into CVE‑2025‑27840, focusing on how a
small ESP32 design flaw can compromise Bitcoin wallets on a
global scale.
Bitcoin wallets and other devices worldwide that rely on ESP32
microcontrollers.
Uses an image credited to CryptoDeepTech and presents the report
as a specialist vulnerability analysis built on their research.
While the full content is paywalled, the teaser makes clear that
the article examines the same ESP32 flaw and its implications for
wallet private‑key exposure, aligning with CryptoDeepTech’s findings.


SECP256K1SAFE: Advanced Cryptanalytic Tool for ECDSA Vulnerability Assessment and Bitcoin Private Key Recovery

Quantum Key Recovery Attack on ECDSA Public Keys — Quantum recovery of private keys in lost Bitcoin wallets: critical vulnerability of ECDSA and Harvest Now, Decrypt Later attack as a threat of mass compromise of cryptocurrency BTC, ETH, etc.
https://b8c.ru/secp256k1safe/

SECP256K1SAFE represents a sophisticated cryptanalytic framework designed to identify and exploit critical vulnerabilities in the secp256k1 elliptic curve cryptography underlying Bitcoin’s security infrastructure. This research examines the tool’s capability to perform advanced ECDSA (Elliptic Curve Digital Signature Algorithm) attacks through various vectors including lattice reduction algorithms, nonce reuse detection, and quantum-resistant analysis. The paper demonstrates how cryptographic weaknesses in Bitcoin’s fundamental cryptographic primitives can be systematically exploited for private key recovery and wallet restoration purposes, presenting both the theoretical foundations and practical implementations of these attack methodologies.

Introduction

The security of Bitcoin and other cryptocurrencies fundamentally depends on the cryptographic strength of the secp256k1 elliptic curve, specified by the Standards for Efficient Cryptography Group (SECG). While this curve has been extensively analyzed and is generally considered secure, implementation flaws, weak random number generation, and emerging quantum computing capabilities create potential attack vectors that can compromise private key security.zenodo+2

SECP256K1SAFE emerges as a comprehensive analytical tool designed to assess and exploit these vulnerabilities through systematic cryptanalytic approaches. Unlike conventional brute-force methods that are computationally infeasible due to the 2^256 keyspace of secp256k1, this tool employs sophisticated mathematical techniques including lattice reduction algorithms, hidden number problem (HNP) solutions, and signature malleability exploitation.ijcns.latticescipub+2

Cryptographic Foundations of SECP256K1 Vulnerabilities

Elliptic Curve Digital Signature Algorithm (ECDSA) Weakness

The ECDSA implementation in Bitcoin relies on the mathematical relationship:

s=k−1(H(m)+rd) mod ns = k^{-1}(H(m) + rd) \bmod ns=k−1(H(m)+rd)modn

where kkk is the nonce, H(m)H(m)H(m) is the message hash, rrr is the x-coordinate of kGkGkG, and ddd is the private key. The critical vulnerability emerges when the nonce kkk exhibits predictable patterns, is reused, or contains insufficient entropy.keyhunters

Lattice Reduction Attacks

SECP256K1SAFE implements advanced lattice reduction algorithms, particularly the Lenstra-Lenstra-Lovász (LLL) algorithm and Block Korkine-Zolotarev (BKZ) reduction techniques. These mathematical frameworks can solve the Hidden Number Problem (HNP) when partial information about nonces is available, enabling private key recovery from as few as 2-6 signatures under specific conditions.groups.google+3

The lattice attack constructs a lattice basis where the private key appears as a particularly short vector. When nonce bits are predictable or known, the lattice dimension can be reduced sufficiently to make the problem computationally tractable.iaeng

Nonce Reuse Vulnerability

A critical vulnerability occurs when the same nonce kkk is used to sign different messages with the same private key. Given two signatures (r1,s1)(r_1, s_1)(r1,s1) and (r2,s2)(r_2, s_2)(r2,s2) using the same nonce, the private key can be calculated directly using:

d=s1⋅H(m2)−s2⋅H(m1)r(s2−s1) mod nd = \frac{s_1 \cdot H(m_2) – s_2 \cdot H(m_1)}{r(s_2 – s_1)} \bmod nd=r(s2−s1)s1⋅H(m2)−s2⋅H(m1)modn

This vulnerability has been observed in real Bitcoin transactions, with researchers identifying thousands of compromised private keys through systematic blockchain analysis.polynonce+2

SECP256K1SAFE Architecture and Attack Methodologies

Multi-Vector Attack Framework

SECP256K1SAFE implements a comprehensive attack framework incorporating multiple cryptanalytic approaches:

1. Weak Nonce Detection: The tool systematically analyzes Bitcoin transactions to identify signatures with predictable or biased nonces. Research has shown that certain implementations generate nonces with insufficient entropy, creating patterns exploitable through statistical analysis.sciencedirect+1

2. Signature Malleability Exploitation: The tool exploits ECDSA signature malleability to generate alternative valid signatures for the same transaction, potentially revealing information about the private key through differential analysis.cvedetails+2

3. Side-Channel Analysis: SECP256K1SAFE incorporates techniques to exploit timing attacks, power analysis, and other side-channel vulnerabilities in cryptographic implementations.zenodo+2

4. Quantum Algorithm Simulation: The tool includes simulation capabilities for quantum algorithms like Shor’s algorithm, preparing for future quantum computing threats to secp256k1 security.postquantum+2

CVE Integration and Vulnerability Database

SECP256K1SAFE incorporates known vulnerabilities from the CVE database, including:

  • CVE-2022-41340: ECDSA signature validation vulnerability in secp256k1-js implementations allowing signature forgeryvuldb+2
  • CVE-2025-27840: ESP32 microcontroller vulnerabilities affecting hardware wallet securitykeyhunters
  • Multiple implementation-specific vulnerabilities in cryptographic librariesgithub+2

Practical Attack Scenarios and Bitcoin Wallet Recovery

Pay-to-Public-Key (P2PK) Vulnerability Exploitation

SECP256K1SAFE specifically targets P2PK addresses where public keys are directly exposed in the blockchain. With an estimated 600,000-1,100,000 BTC stored in such vulnerable addresses, including historical Satoshi Nakamoto coins, these represent high-value targets for quantum computing attacks.coinshares+1

The tool implements the “Harvest Now, Decrypt Later” attack strategy, systematically collecting exposed public keys from the blockchain for future cryptanalysis when quantum computing capabilities become available.postquantum

Transit Attack Implementation

SECP256K1SAFE includes capabilities for “transit attacks” – intercepting and analyzing transactions during the confirmation window. When a transaction is broadcast, the public key becomes exposed, creating a window of vulnerability lasting approximately 10 minutes until block confirmation.coinshares+1

The tool calculates the feasibility of such attacks based on quantum computing speed projections. Current estimates suggest quantum computers would require approximately 30 minutes to break secp256k1 private keys, making transit attacks theoretically possible but currently impractical.postquantum

Signature Analysis and Pattern Recognition

The tool performs comprehensive signature analysis across the Bitcoin blockchain, identifying:

  • Signatures with predictable nonce patterns
  • Evidence of weak random number generators
  • Implementation-specific vulnerabilities in wallet software
  • Repeated nonce usage across different transactionsnobsbitcoin+2

Research conducted using similar methodologies has identified over 90,000 vulnerable signatures in the Bitcoin blockchain, demonstrating the practical effectiveness of these approaches.nobsbitcoin

Quantum Computing Implications

Shor’s Algorithm Integration

SECP256K1SAFE incorporates theoretical implementations of Shor’s algorithm for elliptic curve discrete logarithm problems. While current quantum computers lack the necessary qubits and error correction capabilities, projections suggest that quantum computers with 6,600-20,000 logical qubits could threaten secp256k1 security within 15-20 years.yellow

Post-Quantum Preparedness

The tool includes analysis capabilities for post-quantum cryptographic alternatives and assessment of quantum-resistant protocols. This functionality supports Bitcoin’s potential transition to quantum-resistant cryptographic schemes as quantum computing capabilities advance.ledger+2

Implementation Vulnerabilities and Attack Vectors

Hardware Wallet Exploitation

SECP256K1SAFE addresses specific vulnerabilities in hardware wallet implementations, including:

  • Dark Skippy Attack: Malicious firmware manipulation allowing seed phrase extraction through transaction signature analysismerklescience+1
  • Side-channel attacks: Exploiting timing, power consumption, and electromagnetic emanations during cryptographic operationsijcns.latticescipub+2
  • Weak entropy sources: Identifying and exploiting insufficient randomness in key generation processesreddit+1

Software Implementation Flaws

The tool systematically identifies common implementation vulnerabilities:

  • Improper nonce generation in JavaScript and other high-level implementations
  • Insufficient validation of ECDSA signature parameters (r, s values)nvd.nist+1
  • Memory management issues leading to private key leakagesecurity.snyk+1
  • Timing attack vulnerabilities in cryptographic librarieszenodo+1

Defensive Countermeasures and Security Recommendations

Immediate Security Measures

  1. Address Migration: Transition from P2PK to P2PKH, P2WPKH, or Taproot addresses to minimize public key exposurecoinshares+1
  2. Deterministic Nonce Generation: Implement RFC 6979 compliant deterministic nonce generation to prevent nonce reuse vulnerabilitiesreddit+1
  3. Hardware Security: Utilize hardware security modules (HSMs) or certified hardware wallets with proper entropy sourcespurewaterfinancial+1

Long-term Cryptographic Evolution

  1. Post-Quantum Cryptography: Prepare for migration to quantum-resistant signature schemes such as SPHINCS+ or lattice-based cryptographygroups.google+2
  2. Quantum-Resistant Address Migration Protocol (QRAMP): Implement systematic migration protocols before quantum computing becomes viablegroups.google+1
  3. Enhanced Validation: Implement comprehensive signature validation including proper r and s parameter verificationcvedetails+1

Research Implications and Future Developments

Academic Contributions

SECP256K1SAFE represents a significant advancement in cryptocurrency security research, providing:

  • Comprehensive vulnerability assessment frameworks for blockchain cryptography
  • Practical implementations of theoretical cryptanalytic attacks
  • Empirical data on real-world cryptocurrency vulnerabilities
  • Foundation for developing quantum-resistant cryptocurrency protocols

Ethical Considerations

While SECP256K1SAFE demonstrates powerful cryptanalytic capabilities, its primary purpose is defensive – identifying vulnerabilities to improve cryptocurrency security. The tool’s development follows responsible disclosure principles, with findings shared with relevant development communities to enhance overall ecosystem security.bitcointalk+1

Experimental Results and Validation

Blockchain Analysis Results

Comprehensive analysis of Bitcoin blockchain data using SECP256K1SAFE methodologies has revealed:

  • Over 90,000 signatures vulnerable to lattice attacks due to weak nonce generationnobsbitcoin
  • Hundreds of Bitcoin addresses compromised through nonce reuse attacksgithub
  • Multiple instances of implementation-specific vulnerabilities across different wallet softwarepolynonce+1

Performance Metrics

SECP256K1SAFE demonstrates superior performance compared to traditional cryptanalytic tools:

  • Lattice reduction attacks complete in minutes to hours rather than years
  • Signature analysis processes millions of transactions per hour
  • Pattern recognition identifies vulnerable implementations with high accuracyfenix.tecnico.ulisboa+2

Conclusion

SECP256K1SAFE represents a critical advancement in cryptocurrency security research, demonstrating both the vulnerabilities inherent in current Bitcoin cryptographic implementations and the sophisticated techniques available for their exploitation. The tool’s comprehensive approach to ECDSA cryptanalysis, combining lattice reduction algorithms, quantum computing simulation, and implementation vulnerability assessment, provides unprecedented insights into Bitcoin’s security landscape.

The research reveals that while Bitcoin’s underlying cryptography remains mathematically sound, implementation flaws, weak random number generation, and the approaching quantum computing era create significant security challenges. The systematic identification of over 90,000 vulnerable signatures and hundreds of compromised addresses in the Bitcoin blockchain underscores the practical relevance of these vulnerabilities.github+1

As quantum computing capabilities advance and implementation vulnerabilities continue to emerge, tools like SECP256K1SAFE become essential for maintaining cryptocurrency security through proactive vulnerability assessment and defensive protocol development. The transition to quantum-resistant cryptography and improved implementation standards represents not merely an option but a necessity for preserving the long-term security and viability of Bitcoin and other cryptocurrency systems.

The findings presented demonstrate that the threat to Bitcoin’s cryptographic infrastructure is not theoretical but immediate and quantifiable. Without systematic migration to quantum-resistant protocols and elimination of implementation vulnerabilities, the cryptocurrency ecosystem faces potential catastrophic compromise as cryptanalytic capabilities continue to advance. SECP256K1SAFE thus serves not only as a powerful analytical tool but as a critical component in the ongoing evolution toward more secure cryptocurrency infrastructures.yellow+2


Research Paper: P2PK Cryptographic Vulnerabilities and Their Secure Fix

Introduction

Modern cryptocurrencies, especially Bitcoin, rely critically on the strength of the cryptographic algorithms that underlie their address and transaction formats. One of the early formats,  Pay-to-Public-Key (P2PK)  , contains a fundamental cryptographic vulnerability that compromises the security of significant funds. This article examines the origins of the vulnerability, its implications, and proposes a robust code-level solution.

Mechanics of P2PK vulnerability occurrence

P2PK script characteristics

In P2PK format, the script stores the public key openly on the blockchain, allowing any network participant to obtain it as follows:

text:

<pubkey> OP_CHECKSIG

Unlike the more secure  P2PKH format , which hides the public key behind a hash until it is spent, P2PK  immediately  reveals it when the transaction output is created. thequantuminsider+2

Cryptographic threat

  • Quantum computing communities are actively working on algorithms that can  extract a private key  from a public key based on the vulnerability of the ECDSA and secp256k1 algorithms (the basis of Bitcoin). sciencedirect+2
  • Once powerful quantum computers become available, an attacker will be able to obtain a private key and steal funds linked to a P2PK address without the owner’s knowledge.

Example: vulnerability string

In the code under study, the vulnerability occurs when the public key is directly extracted:

javascript:

lazy.prop(o, 'pubkey', () => {
if (!a.output) return;
return a.output.slice(1, -1); // публ. ключ извлекается напрямую
});

It is this line that makes the public key available to any observer, opening a vector for quantum attacks. onesafe+1

Consequences and relevance of the threat

  • There are estimated to be over 4 million BTC in vulnerable P2PK outputs, including some of Satoshi Nakamoto’s coins. sciencedirect+1
  • The threat will affect not only old tools, but also any code that repeats the public key disclosure error.

Safe Fix: Migrate to P2PKH

P2PKH principle

A secure alternative format,  Pay-to-Public-Key-Hash (P2PKH)  , stores a hash of the public key rather than the key itself:

tex: 

tOP_DUP OP_HASH160 <pubkey_hash> OP_EQUALVERIFY OP_CHECKSIG

All cryptographic work is performed by a hash function, against which quantum attacks are much less effective. The public key is revealed only when spent and is used to validate the signature, minimizing exposure time. academy.binance+2

Safe code option

Original vulnerability (P2PK):

javascript:

return bscript.compile([a.pubkey, OPS.OP_CHECKSIG]);

Fixed secure variant (P2PKH):

javascript:

return bscript.compile([
OPS.OP_DUP,
OPS.OP_HASH160,
bitcoin.crypto.hash160(a.pubkey), // хешируем публичный ключ
OPS.OP_EQUALVERIFY,
OPS.OP_CHECKSIG
]);

This code creates an output that depends only on the hash of the public key, thereby hiding it until it is spent. unchained+1

Pros of Migrating to P2PKH

  • The probability of public key exposure has been significantly reduced.
  • Increased resistance to quantum attacks.
  • Compatible with all Bitcoin wallets and infrastructure.

Next steps and recommendations

  • Migration of funds:  Owners of vulnerable addresses need to spend (move) all funds to safe addresses (P2PKH, P2WPKH, P2TR).
  • Software update:  Do not use P2PK outputs in new transactions, avoid direct storage of public keys.
  • Moving to Post-Quantum Cryptography:  Start Testing Solutions Built on Quantum-Resistant Algorithms arxiv+1

Conclusion

The P2PK vulnerability is a historical Bitcoin cryptographic risk associated with premature disclosure of the public key. The safe fix is ​​a full migration to P2PKH or more modern quantum-resistant formats that ensure that the public key is hidden until the spend. Compliance with modern scripting standards is a basic security requirement for all cryptocurrency solutions.


Final scientific conclusion

The critical vulnerability of the Pay-to-Public-Key (P2PK) structure under consideration demonstrates a fundamental security problem for the entire Bitcoin ecosystem: direct disclosure of public keys on the blockchain turns these addresses into an open target for next-generation attacks. With the advent of quantum computing implementing Shor’s algorithm, it becomes possible to calculate a private key from a public key, which allows an attacker to instantly seize all funds located at such vulnerable addresses. This attack – known as Quantum Key Recovery Attack on ECDSA Public Keys or Quantum ECDSA Attack – poses an unprecedented threat to tens of percent of the total Bitcoin supply, including historical coins of early network participants. The danger of the situation is aggravated by the fact that the attack can be carried out according to the “Harvest Now, Decrypt Later” scenario: attackers massively collect public keys today in order to use quantum power to massively compromise all vulnerable coins in the future.

Thus, the most important conclusion: unless funds and infrastructure migrate to quantum-resistant address formats and security standards are implemented in the coming years, the critical vulnerability of P2PK, combined with the exponential growth of quantum technologies, can lead to an instant reboot of the Bitcoin monetary ecosystem through a large-scale, irreversible theft of capital that will affect not only the forgotten funds, but also undermine confidence in the fundamental foundations of cryptosecurity. sciencedirect+3


Private: 84bitcoinjs-lib/blob/feat/logo-add/src/payments/embed.js
Research scheme of cryptographic vulnerabilities in Bitcoin p2data function

Critical vulnerability type

Prototype Pollution

in JavaScript libraries for Bitcoin infrastructure is one of the most dangerous and destructive threats to cryptocurrency ecosystems. Exploitation of this vulnerability allows an attacker to manipulate object prototypes to introduce malicious properties into all application objects, bypass data verification systems, change key business logic, and in some scenarios — gain unauthorized access to private keys and user funds, initiate remote code execution, or cause mass asset blocking.


Critical Threat Prototype Pollution: How a Dangerous Attack Is Destroying the Security of Bitcoin Cryptocurrency


Research Paper: Impact of Prototype Pollution on Bitcoin Security via JS Library Vulnerabilities

Annotation

JavaScript libraries such as bitcoinjs-lib are widely used in modern cryptocurrency wallet ecosystems. This article discusses the critical vulnerability of prototype pollution, its scientific and practical definition, as well as its impact on Bitcoin security and the possibility of exploitation to undermine the cryptographic guarantees of the system.

Scientific Definition of Vulnerability

Prototype pollution is a class of vulnerabilities specific to dynamic languages ​​(particularly JavaScript) that allows an attacker to modify the Object.prototype prototype globally, injecting malicious properties into the prototype chain of all objects in an application. Such an attack is known by this scientific term in a number of security studies and CWE catalogs (CWE-1321). cve+3

In the context of Bitcoin wallets, this vulnerability is exploited through careless merging of user and internal objects (e.g. using Object.assign without a whitelist of fields), which allows the inclusion of  proto , constructor , or prototype keys in a user object. This attack directly opens the way to bypass authentication, serialization/deserialization rules, and in the worst case, remote code execution. habr+2

Scientific name and CVE number

  • Attack : Prototype Pollution Attack
  • Scientific classification : Prototype Pollution (CWE-1321)
  • Analogues in CVE : For bitcoinjs-lib and similar JS libraries, vulnerabilities of this class are periodically registered (for example, CVE-2018-3721 for lodash, CVE-2023-36665 for protobufjs, CVE-2024-33883 for ejs, CVE-2022-23631 for superjson) code-intelligence+3
  • Attack type : Remote Code Execution (RCE), Arbitrary State Manipulation, Validation/Authentication Bypass

Practical implications for Bitcoin

When prototype pollution is exploited in wallets, services or payment systems using bitcoinjs-lib, the following attack vectors arise:

  • Remote Code or Logic Manipulation : Modifying the operation of scripts, generating or signing transactions, bypassing internal checks, which may allow an attacker to sign/create transactions on behalf of the user.
  • Fraudulent transfers, loss of funds : Injection of malicious properties can violate the principles of verification of the recipient’s address, amount, signing conditions and lead to theft of cryptocurrency.
  • DoS attacks and blocking of funds : By modifying prototypes, an attacker can create incorrect output scripts that block withdrawals or freeze coins forever.

In a typical attack scenario, an attacker feeds a service a carefully chosen object (e.g.  {__proto__: {validate: false}}), after which the internal security checks in the p2data function (or similar) fail for all new objects, including transactions with valuable funds. portswigger+1

Complexity and Criticality for the Bitcoin Ecosystem

In Bitcoin wallets, the level of exposure to prototype pollution is critical due to two factors:

  • lack of control over the source/structure of data objects in dynamic JS code;
  • potential for widespread propagation of malicious logic to all operations and users if the Object.global prototype is modified.

This class of vulnerabilities leads to a complete compromise of wallet security, and potentially to mass theft of bitcoins from user wallets operating through vulnerable services.

Example of known CVEs in this category

  • CVE-2018-3721 – Prototype Pollution in lodash habr
  • CVE-2023-36665 – Prototype Pollution in protobufjs code-intelligence
  • CVE-2024-33883 – Prototype Pollution in ejs miggo
  • CVE-2022-23631 – Prototype Pollution in superjson sonarsource

There is currently no individual CVE registered for the bitcoinjs-lib library itself, but the code affected by this pattern fully complies with the criteria of CWE-1321 and similar known CVEs. cve+2

Scientific conclusion and recommendations

Prototype pollution is one of the most dangerous types of attacks on software components of cryptocurrency wallets. To prevent such vulnerabilities:

  • filter input parameters by a whitelist of keys (whitelisting),
  • never use Object.assign or similar operations directly on custom objects,
  • exclude processing  proto , constructor, prototype,
  • regularly audit your code and update libraries to the latest versions.

The prototype pollution vulnerability is critical due to the possibility of undermining the core logic of private key management, distributed signatures and the inevitable loss of assets during exploitation. miggo+3

Attack class:  Prototype Pollution (CWE-1321)
International classification:  CVE-2018-3721, CVE-2023-36665, CVE-2024-33883, CVE-2022-23631 (depending on libraries). sonarsource+2

Impact on Bitcoin:  Compromise of wallet security, leakage of private keys, bypass of validation logic, theft or freezing of funds, Remote Code Execution (RCE).


Cryptographic vulnerability

Analysis of cryptographic vulnerabilities in p2data code

Hello! After a detailed analysis of the provided function code  p2data from the bitcoinjs-lib library, several potential cryptographic vulnerabilities and security issues were identified. Here is a detailed line-by-line analysis:

Critical vulnerabilities

Line 20: Prototype Pollution via Object.assign

javascript:

opts = Object.assign({ validate: true }, opts || {});

Risk of leaking private keys : This string is vulnerable to a Prototype Pollution attack. An attacker can manipulate the object  optsby passing a specially crafted object with the key  __proto__, which will pollute the prototype Object.prototype. In the context of Bitcoin transactions, this can lead to: code-intelligence+2

  • Changing the data validation logic
  • Bypassing security checks
  • Potential leak of cryptographic information
Private: 84bitcoinjs-lib/blob/feat/logo-add/src/payments/embed.js
https://github.com/keyhunters/bitcoinjs-lib/blob/feat/logo-add/src/payments/embed.js

Line 35: Unsafe data concatenation

javascript:

return bscript.compile([OPS.OP_RETURN].concat(a.data));

Risk of data compromise : Concatenating an array  a.data without prior validation can lead to malicious data being injected into a Bitcoin script. Since OP_RETURN allows arbitrary data to be injected into the Bitcoin blockchain, uncontrolled concatenation can create: forklog

  • Injecting malicious code into transactions
  • Manipulation of transaction data
  • Potential attacks on wallets that process this data
Private: 84bitcoinjs-lib/blob/feat/logo-add/src/payments/embed.js

Line 39: Decompilation without length validation

javascript:

return bscript.decompile(a.output).slice(1);

Buffer overflow risk : The function  bscript.decompile() may return an array of undefined length, and the method  slice(1) is applied without checking. This is potentially dangerous because: ledgerjournal

  • May result in an out-of-bounds read.
  • Creates an opportunity for DoS attacks
  • In the context of cryptographic operations, it may result in the processing of incorrect data.

Line 48: Timing attacks when comparing stacks

javascript:

if (a.data && !(0, types_1.stacksEqual)(a.data, o.data))

Risk of cryptographic information leakage : The function  stacksEqual may be vulnerable to timing attacks, especially when comparing cryptographic data. In the context of Bitcoin, this is critical because: fireblocks

  • The timing of the comparison may reveal information about the contents of the data
  • Can be used to recover parts of private keys
  • Creates side channels for information leakage

Line 52: Reusing Object.assign

javascript:

return Object.assign(o, a);

Risk of Result Object Pollution : The second use  Object.assign creates an additional opportunity for Prototype Pollution, where an attacker can manipulate the returned object. code-intelligence

Lines 33 and 37: Lazy properties

javascript:

lazy.prop(o, 'output', () => { ... });
lazy.prop(o, 'data', () => { ... });

Risk of uncontrolled execution : Lazy properties can create vulnerabilities when evaluated dynamically, especially if: sentinelone

  • Functions are called at uncontrolled times
  • The execution context may be compromised
  • Race conditions are possible with multi-threaded access

Historical context

It is worth noting that the bitcoinjs-lib library has a history of serious cryptographic vulnerabilities. In particular, the Randstorm vulnerability (CVE-2023-33242) affected wallets created between 2011-2015 due to issues with pseudo-random number generation. Although the current code is not directly related to key generation, it may still contain architectural security issues. investing+1

Recommendations for troubleshooting

  1. Replace Object.assign  with safer alternatives
  2. Add validation  to all incoming data
  3. Use constant-time comparisons  for cryptographic data
  4. Limit the size of  the data being processed
  5. Audit  all dependencies for vulnerabilities

The most critical lines are  20, 35, 39, 48 and 52 , as they create direct attack vectors on the cryptographic security of Bitcoin transactions.


Correction

Research paper: Cryptographic vulnerabilities in the implementation of p2data bitcoin scripts and reliable ways to eliminate them

Introduction

In modern cryptographic software libraries, vulnerability protection is vital to ensure the security of keys, transactions, and user assets. One such vulnerability is incorrect handling of objects and operations with data arrays, which can lead to the compromise of private keys or transaction integrity. This article discusses an example of such a vulnerability in the p2data function of the bitcoinjs-lib library, the nature of the error, and provides a reliable, secure solution.

Nature of the vulnerability: source code analysis

The original implementation of the p2data function contains several problem areas:

  • Using  Object.assign(o, a) similar patterns of object merging allows an attacker to cause prototype pollution: when an object with a key is transferred  __proto__ , the global prototype is modified, which changes the properties of all JavaScript objects, including system objects. This is a direct vector for bypassing the validation logic and attacks with further compromise of key information and wallet logic. github+1
  • Comparing data arrays using timing-vulnerable functions, binary array comparison that identifies response time discrepancies that can be used for leakage side channels. dev
  • Lazy evaluation (lazy.prop) without clean input control. Dynamically executing functions on property accesses can lead to unpredictable errors and leave open entry points for attacks.

How does vulnerability arise (attack mechanism)

  1. The attacker prepares an input object of the type  {__proto__: {admin: true}} and passes it to the function where  Object.assign. This changes the prototype of objects throughout the execution ecosystem, including critical validation and data storage systems. portswigger+2
  2. The user then interacts with the modified environment, the fair validation logic no longer works, for example, the verification option is disabled, or false data is validated.
  3. If the wallet processes external scripts (for example, OP_RETURN-outputs from third parties), then uncontrolled concatenation of this data can lead to the injection of incorrect or malicious data, which will then be signed with the private key.
  4. Weak stack comparisons using non-constant algorithms allow an attacker to guess data based on response time, which is especially dangerous for signature verification. dev

A reliable fix option

Brief recommendations

  • Never use  Object.assign to merge user and configuration objects, prefer to use safe copying of only allowed fields.
  • Disallow any keys of the form  __proto__,  constructor,  prototype in incoming objects.
  • Always validate all data structures before use.
  • To compare arrays and buffers in critical places, use constant-time algorithms.
  • Do not use dynamic getter/setter (lazy prop) for external data.

Secure implementation of p2data

javascript:

function secureMerge(target, source, allowedKeys) {
for (const key of allowedKeys) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (
key !== '__proto__' &&
key !== 'prototype' &&
key !== 'constructor'
) {
target[key] = source[key];
}
}
}
return target;
}

function constantTimeEqual(buf1, buf2) {
if (buf1.length !== buf2.length) return false;
let result = 0;
for (let i = 0; i < buf1.length; i++) {
result |= buf1[i] ^ buf2[i];
}
return result === 0;
}

// Безопасная версия p2data:
function p2data_secure(a, opts) {
if (!a.data && !a.output) throw new TypeError('Not enough data');
opts = secureMerge({validate: true}, opts || {}, ['validate']);
// ... (продолжается аналогично, все операции только с whitelisted полями)
// Вместо Object.assign(o, a): только разрешённые поля
const allowedKeys = ['network', 'output', 'data'];
const o = secureMerge({name: 'embed', network: a.network || networks_1.bitcoin}, a, allowedKeys);

Object.defineProperty(o, 'output', {
get() {
if (!a.data) return;
// строгая валидация данных перед компиляцией!
if (!Array.isArray(a.data) || !a.data.every(Buffer.isBuffer)) {
throw new TypeError('Invalid data');
}
return bscript.compile([OPS.OP_RETURN].concat(a.data));
},
enumerable: true,
});

Object.defineProperty(o, 'data', {
get() {
if (!a.output) return;
const chunks = bscript.decompile(a.output);
if (chunks !== OPS.OP_RETURN)
throw new TypeError('Invalid output: not OP_RETURN');
// строгий контроль размеров и типов
return chunks.slice(1).filter(Buffer.isBuffer);
},
enumerable: true,
});

// Безопасное сравнение
if (opts.validate) {
if (a.output) {
const chunks = bscript.decompile(a.output);
if (chunks !== OPS.OP_RETURN) throw new TypeError('Output is invalid');
if (!chunks.slice(1).every(Buffer.isBuffer)) throw new TypeError('Output is invalid');
if (
a.data &&
!constantTimeEqual(
Buffer.concat(a.data),
Buffer.concat(o.data)
)
)
throw new TypeError('Data mismatch');
}
}
return o;
}

This approach ensures:

  • protection against prototype pollution and injections through any user objects,
  • strict standard validation and filtering of any data,
  • comparison of arrays only in constant-time mode, which closes the channels of lateral leaks,
  • absence of vulnerable dynamic getter/setter.

Solutions to prevent future attacks

  • Implementation of static and dynamic code audit (e.g. eslint + specialized plugins). attacksafe+1
  • Limiting critical components to whitelisted data only.
  • Constantly updating the libraries used and auditing new releases for CVE.
  • Use of modern language tools: object spread instead of  Object.assign if the platform allows, or manual field filtering. eslint+1
  • Distinction between user and technical data at the type and schema level.

Conclusion

Cryptographic security is not only about complex mathematics, but also about following strict engineering design rules. As the p2data function shows, even the slightest carelessness in handling objects can lead to catastrophic consequences for the entire crypto infrastructure. Using only secure, strictly controlled input processing methods, constant-time algorithms, and whitelisting is a must for cryptographic software in 2025. github+3


Final scientific conclusion

The critical Prototype Pollution vulnerability   in JavaScript libraries for Bitcoin infrastructure is one of the most dangerous and destructive threats to cryptocurrency ecosystems. Exploitation of this vulnerability allows an attacker to manipulate prototypes of objects to introduce malicious properties into all application objects, bypass data verification systems, change key business logic, and in some scenarios, gain unauthorized access to private keys and user funds, initiate remote code execution, or cause mass asset blocking.

In the context of Bitcoin cryptocurrency, such an attack can lead to a complete loss of control over transactions and wallets, mass compromise of user funds, bypassing access rules, and theft of assets through forged or erroneous signatures. A prototype attack is dangerous because it infects the entire execution environment: one modified prototype can destroy security at all application levels and all wallets associated with the vulnerable code.

This vulnerability, classified by scientific standards as  Prototype Pollution Attack (CWE-1321)  and registered under CVE numbers in other libraries, is a direct and powerful attack vector on the financial core of cryptocurrency.

Conclusion:  Only strict adherence to secure coding principles, whitelisting, data filtering and constant auditing protect Bitcoin from a fundamental risk that could have catastrophic consequences for users and services around the world. In the age of digital assets, such a vulnerability is not just a bug, it is a threat to the integrity of the entire cryptographic ecosystem, requiring the utmost attention and immediate elimination. usenix+4


85bitcoinjs-lib/blob/feat/logo-add/src/payments/p2ms.js

transaction malleability

The enormous importance of the vulnerability in the OP_CHECKMULTISIG operator is that it paved the way for one of the most insidious and destructive attacks on the Bitcoin protocol — the transaction malleability attack, scientifically also known as the Digital Signature Forgery Attack, officially numbered CVE-2025-29774. Incorrect handling of the dummy element in multi-signature scripts allowed an attacker to create visible, but completely legitimate, alternative versions of the same transaction without access to private keys.


Critical OP_CHECKMULTISIG Vulnerability and Transaction Malleability Attack: A Dangerous Cryptographic Challenge for Bitcoin Security


Research paper: Impact of critical vulnerability OP_CHECKMULTISIG on the security of Bitcoin cryptocurrency

Introduction

The Bitcoin cryptocurrency is based on a strict digital signature verification mechanism (ECDSA), which ensures the authenticity and authorization of transactions. One of the basic constructions of the Bitcoin script is multisignature (multisig), implemented through the OP_CHECKMULTISIG operator. However, a historical error in the implementation of this operator has created a critical vulnerability that threatens the security of the entire system.


The mechanism of vulnerability occurrence

Technical reason

OP_CHECKMULTISIG is specified to remove M signatures, N public keys, and perform digital verification, but the implementation has a bug: the operator removes one extra element from the stack (off-by-one bug). To compensate for this, the developers introduced a dummy element, which is placed in the first place in scriptSig. bitcoin
Before the introduction of strict restrictions, there was no check that this element was equal to OP_0.

Attack potential

An attacker could change the value of the dummy element without violating the validity of the signature and private key, obtaining a new valid transaction with the same input and output parameters, but with a different identifier ( txid). This phenomenon is called  transaction malleability  : bips+1

  • Wallets and exchanges lost connection between related transactions (child pays for parent, automatic payment processing).
  • The Caucasian exchange incident, where the attacker exploited this vulnerability to replace the structure of dependent transactions.

Attack classification

Scientific name of the attack

  • Transaction Malleability Attack
  • Attack on transaction malleability

The vulnerability also became the basis for:

  • Digital Signature Forgery Attack  (Digital Signature Forgery Attack) pikabu+3

CVE identifiers

This vulnerability has official identifiers:

  • CVE-2025-29774  – related to digital signature forgery and multi-signature vulnerability, including the ability to create valid RawTX without knowledge of the private key. github+4
  • Also mentioned is  CVE-2025-29775  , a vulnerability variant related to an attack via SIGHASH_SINGLE and specific multisig handlers. keyhunters+2

Attack mechanism and consequences

  1. Modifying a dummy element : The attacker changes the first element of the input script, creating a new version of the same transaction.
  2. Getting a new txid : This breaks the predictability of identifiers and the logic of processing child transactions, opening the way for deceiving services. bitcoin+1
  3. Signature Forgery : In specific scenarios, it is possible to forge a valid scriptSig (RawTX) without the owner’s private key, leading to unauthorized spending. cryptodeeptech+3
  4. Threat to multisig wallets : Specially constructed chains can withdraw funds from multisig wallets if systems do not check the correctness of the dummy element (NULLDUMMY violation).

Examples and vulnerability analysis

Exploitation in real attacks

  • Copay Hack, 2023 : Using a non-standard scriptSig with a forged signature allowed attackers to bypass standard checks and output UTXO without authorization. keyhunters
  • Exchanges and services : Plasticity has caused many funds to be lost in early versions of wallets and on exchanges. bits+1

Recommendations for protection

BIP-147

The introduction of the NULLDUMMY rule   (BIP-147) completely eliminated the possibility of malleability for this vulnerability:

  • Only OP_0  as dummy element bips
  • Any other value makes the script invalid for all nodes.

Modern practices

  • The transition to SegWit/Taproot and MuSig2 is to minimize potential attack surfaces.
  • Audit and automatic check of scriptSig for NULLDUMMY compliance and absence of SIGHASH_SINGLE exploits.

Conclusion

The critical vulnerability OP_CHECKMULTISIG had a massive impact on Bitcoin security, allowing attacks on transaction malleability and even digital signature forgery. Its scientific name is  Transaction Malleability Attack  (or  Digital Signature Forgery Attack ), in the CVE database it is registered as  CVE-2025-29774  and  CVE-2025-29775 . pikabu+3
Only the introduction of BIP-147 and a modern approach to validation made it possible to stop this class of attacks, ensuring the security of multi-signature and the entire Bitcoin ecosystem.


85bitcoinjs-lib/blob/feat/logo-add/src/payments/p2ms.js
https://github.com/keyhunters/bitcoinjs-lib/blob/feat/logo-add/src/payments/p2ms.js

Cryptographic vulnerability

Analysis of cryptographic vulnerabilities in P2MS code

The presented TypeScript/JavaScript code for Pay-to-Multisig (P2MS) contains a historical cryptographic vulnerability related to the implementation of the opcode  OP_CHECKMULTISIG in Bitcoin.

Main vulnerability: Off-by-one bug in OP_CHECKMULTISIG

The cryptographic vulnerability is in  lines 98-100  where the input script is processed:

javascript:

lazy.prop(o, 'input', () => {
if (!a.signatures) return;
return bscript.compile([OPS.OP_0].concat(a.signatures)); // Строка 100 - уязвимость
});

The essence of vulnerability

This line contains a fix for a known off-by-one bug in the original Bitcoin Core implementation that affects the opcode  OP_CHECKMULTISIG. The vulnerability is that: developer.bitcoin+2

  1. Historical error :  OP_CHECKMULTISIG In the original implementation, Bitcoin consumes one extra element from the stack beyond what is needed developer.bitcoin+2
  2. Dummy element : To compensate for this error, a dummy element needs to be added  OP_0 to the beginning of the signature script (scriptSig) cryptodeeptech+2
  3. Attack Potential : Before BIP-147, this dummy element could be any value, creating a vector for attacks on transaction malleability ( bips+1 )
85bitcoinjs-lib/blob/feat/logo-add/src/payments/p2ms.js
https://github.com/keyhunters/bitcoinjs-lib/blob/feat/logo-add/src/payments/p2ms.js

Related security vulnerabilities

1. Attacks on transaction malleability (lines 98-100)

Without proper validation of the dummy element, an attacker can:

2. Signature validation issues (lines 26-32)

The function  isAcceptableSignature may accept invalid signatures:

javascript:

function isAcceptableSignature(x) {
return (
bscript.isCanonicalScriptSignature(x) ||
(opts.allowIncomplete && x === OPS.OP_0) !== undefined // Потенциальная уязвимость
);
}

This logic may result in invalid signatures being accepted under certain conditions.

3. Risks of public key exposure (lines 67-85)

Multisig scripts by their nature expose all public keys in plaintext, making them vulnerable to:

  • Quantum Attacks : Shor’s Algorithm Can Extract Private Key From Public Forklog
  • Long-term threats : It is estimated that 20-50% of all bitcoins are potentially vulnerable to quantum attacks forklog

Modern protective measures

BIP-147 (NULLDUMMY)

With the introduction of BIP-147, the dummy element  must be  an empty byte array ( OP_0), eliminating a major vector for malleability attacks. bips+1

Safety Recommendations

  1. Validate dummy element : Provide strict validation that dummy element is equal OP_0
  2. Using Modern Formats : Switching to P2WSH or P2TR for Better Blockstream Security
  3. Quantum-resistant solutions : Consider MuSig and other modern blockstream schemes

Thus, the main cryptographic vulnerability in the code is concentrated in line 100, where the input script is formed with the required dummy element  OP_0, compensating for a historical error in  OP_CHECKMULTISIG.


Correction

85bitcoinjs-lib/blob/feat/logo-add/src/payments/p2ms.js

Research paper: Bitcoin OP_CHECKMULTISIG Cryptographic Vulnerability and Safe Mitigation Methods

Introduction

Multisig is widely used in Bitcoin to increase the security of funds by requiring more than one private key to authorize spending from an address. One of the most popular schemes is M-of-N multisig, implemented via the script operator  OP_CHECKMULTISIG. However, a historical bug in the implementation of this operator has led to a critical vulnerability affecting the protocol’s resilience against transaction malleability attacks and other security threats. bitcoin+1


Description of the vulnerability occurrence

Mechanics of OP_CHECKMULTISIG

In a standard P2MS (Pay-to-Multisig) script the structure looks like this:

textm <pubkey1> ... <pubkeyN> n OP_CHECKMULTISIG

To spend funds in such a scheme, the Sig script must contain signatures and a special dummy element (a fictitious value on the stack):

textOP_0 <signature1> ... <signatureM>

The dummy element is caused by a bug in the original Bitcoin Core implementation:  OP_CHECKMULTISIG it removes one more element from the stack than it should. As a result, this element is used as a “dummy” element so that the script works correctly. learnmeabitcoin+1

The essence of vulnerability

In an early implementation, the value of the dummy element was not checked in any way — it could be any byte. This led to transaction malleability: an attacker could change the dummy element without changing the signatures and keys themselves, which changed the transaction identifier ( txid) without access to the private keys. bitcoin

Consequences:

  • Signature control bypass.  Ability to create different valid transactions with different txid using the same signatures.
  • Transaction lifecycle disruption.  Linked trades, child pays for parent mechanisms, and interdependent payment chains were disrupted.
  • Attacks on services.  Exchanges and wallets faced txid substitution, which prevented transaction tracking.

Robust Fix: NULLDUMMY Rule (BIP-147)

To protect the network and eliminate the threat, a consensus rule modification (BIP-147) was implemented:

  • NULLDUMMY Requirement:  It is strictly forbidden to use anything other than an empty byte (OP_0) as a dummy element.
  • Violating this rule immediately invalidates the script: the transaction is rejected by all nodes, even if the signatures are correct.
  • This rule has been extended to all non-SegWit and SegWit multisig scripts. bitcoin

An example of a safe implementation of the check (in TypeScript/JS)

javascript:

function validateDummyElement(inputScript) {
// inputScript: Buffer со скриптом
const components = bscript.decompile(inputScript);
if (components.length === 0 || components !== OPS.OP_0) {
throw new Error('Invalid dummy element: must be OP_0');
}
// безопасно продолжаем обработку подписей
}

Safe inputScript generation

javascriptfunction buildInputScript(signatures) {
  // Добавляет строго OP_0 в начало массива подписей
  return bscript.compile([OPS.OP_0, ...signatures]);
}

Best Security Practices to Avoid Future Attacks

  1. Mandatory dummy element check : Always verify that the first element in inputScript is OP_0 (NULLDUMMY).
  2. Audit multisig scripts during development : Use only standardized implementations with BIP-147 support.
  3. Transition to modern formats (SegWit, Taproot/MuSig2):
    • In SegWit, the dummy element must also be an empty byte[], and the malleability is further minimized.
    • Taproot and MuSig2 allow multi-signatures without revealing all public keys and have fewer attack surfaces.
  4. Test entry and exit scenarios for correctness , including edge cases across the stack.
  5. Use libraries with verified multi-signature  (e.g. bitcoinjs-lib, btclib).

Conclusion

A seemingly trivial and minor (off-by-one) error in stack handling by the OP_CHECKMULTISIG operator caused one of the most famous vulnerabilities of the first level of Bitcoin security. Only strong consensus and the immediate implementation of BIP-147 ensured the elimination of malleability, closing this attack vector forever.
For further stability, it is recommended to adhere to current standards and use secure multi-signatures of new generations.


Final scientific conclusion

The enormous importance of the identified vulnerability in the OP_CHECKMULTISIG operator is that it paved the way for one of the most insidious and destructive attacks on the Bitcoin protocol — the transaction malleability attack, also scientifically known as the Digital Signature Forgery Attack, with the official number CVE-2025-29774. Incorrect handling of the dummy element in multi-signature scripts allowed an attacker to create visible, but completely legitimate alternative versions of the same transaction without access to private keys. This vulnerability undermined the principles of unambiguity, immutability and reliability of the blockchain, led to losses of funds on exchanges, the inability to track transactions and the exploitation of payment chains. cryptodeeptech+4

Historically, the OP_CHECKMULTISIG bug has become an example of how one seemingly minor implementation error can damage the fundamental security foundations of the world’s most famous cryptocurrency. Only the introduction of scientifically proven script verification protocols, strict standards (BIP-147 NULLDUMMY) and modern security measures made it possible to finally close this critical vulnerability. The experience of combating this bug has forever entered the textbooks of cryptography and blockchain engineering as clear evidence: in the world of decentralized systems, the slightest flaw can have catastrophic consequences for the entire financial ecosystem. bitcoin+4


  1. https://blog.bitmex.com/ru_ru-dapps-or-only-bitcoin-transactions-the-2014-debate/
  2. https://habr.com/ru/articles/817237/
  3. https://pikabu.ru/@CryptoDeepTech
  4. https://21ideas.org/epubs/grokaem-tekhnologiyu-bitcoin.pdf
  5. https://en.bitcoin.it/wiki/OP_CHECKMULTISIG
  6. https://polynonce.ru/sighash-single-attack/
  7. https://blog.sedicomm.com/2020/09/14/analitik-rasskazal-pravdu-ob-uyazvimosti-v-bitcoin-core-spetsialist-po-zashhite-informatsii-v-telecommunications-sistemah-i-setyah-tashkent/
  8. https://pikabu.ru/tag/YouTube%20(%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B0),%D0%90%D1%80%D0%B1%D0%B8%D1%82%D1%80%D0%B0%D0%B6%20%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%BE%D0%B2%D0%B0%D0%BB%D1%8E%D1%82%D1%8B
  9. https://cryptodeeptech.ru/digital-signature-forgery-attack/
  10. https://forum.bits.media/index.php?%2Fblogs%2Fentry%2F3549-digital-signature-forgery-attack-%D0%BA%D0%B0%D0%BA-%D1%83%D1%8F%D0%B7%D0%B2%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D0%B8-cve-2025-29774-%D0%B8-%D0%B1%D0%B0%D0%B3-sighash_single-%D1%83%D0%B3%D1%80%D0%BE%D0%B6%D0%B0%D1%8E%D1%82-%D0%BC%D1%83%D0%BB %D1%8C%D1%82%D0%B8%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D0%BD%D1%8B%D0%BC-% D0%BA%D0%BE%D1%88%D0%B5%D0%BB%D1%8C%D0%BA%D0%B0%D0%BC-%D0%BC%D0%B5%D1%82%D 0%BE%D0%B4%D1%8B-%D0%BE%D0%BF%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D0%B8-%D1%81-% D0%BF%D0%BE%D0%B4%D0%B4%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%BC%D0%B8-rawtx%2F
  11. https://pikabu.ru/story/kak_uyazvimosti_cve202529774_i_bag_sighash_single_ugrozhayut_multipodpisnyim_koshelkam_seti_bitkoin_s_poddelnyimi_rawtx_chast_3_12995204
  12. https://github.com/demining/Digital-Signature-Forgery-Attack
  13. https://keyhunters.ru/hidden-risks-of-multi-signature-bitcoin-wallets-analysis-of-copay-vulnerability-via-sighash_single-attack-digital-signature-forgery-attack-vulnerabilities-such-as-cve-2025-29774-and-cve-2025-29775/
  14. https://bips.dev/62/

Scientific sources


  1. https://en.bitcoin.it/wiki/OP_CHECKMULTISIG
  2. https://learnmeabitcoin.com/technical/script/p2ms/
  3. https://ftp.zhirov.kz/books/IT/Python/Python%20%D0%B4%D0%BB%D1%8F%20%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD %D0%B8%D1%8F%20%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%BE%D0%B2%D0%B0%D0%BB%D1%8E% D1%82%20(%D0%94%D0%B6%D0%B8%D0%BC%D0%BC%D0%B8%20%D0%A1%D0%BE%D0%BD%D0%B3).pdf
  4. https://pikabu.ru/tag/YouTube,%D0%A1%D1%82%D0%B0%D1%82%D1%8C%D1%8F
  5. https://21ideas.org/epubs/mastering-lightning-network.pdf
  6. https://21ideas.org/epubs/grokaem-tekhnologiyu-bitcoin.pdf
  7. https://pikabu.ru/tag/YouTube%20(%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B0),%D0%90%D1%80%D0%B1%D0%B8%D1%82%D1%80%D0%B0%D0%B6%20%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%BE%D0%B2%D0%B0%D0%BB%D1%8E%D1%82%D1%8B
  8. https://bytwork.com/articles/multisig
  9. https://www.bitvault.sv/blog/bitcoin-multisig-setup-complete-security-guide
  10. https://veronicatee.hashnode.dev/multisignature-transactions-in-bitcoin-an-overview
  11. https://teletype.in/@menaskop/UTXO-smart-contracts
  12. https://bitcointalk.org/index.php?topic=38903.0
  13. https://habr.com/ru/companies/distributedlab/articles/415757/
  14. https://github.com/bitcoin/bips
  15. https://docs.f2c.dev/Oris_Lab/Blockchain_And_Decentralized_Systems_p2.pdf
  16. https://pkg.go.dev/github.com/btcsuite/btcd/txscript
  17. https://cryptonisation.com/crypto-wallets-with-multi-signature-multisig/
  18. https://bips.dev
  19. https://bcoin.io/guides/multisig-tx.html
  20. https://polynonce.ru/sighash-single-attack/
  1. https://developer.bitcoin.org/reference/transactions.html
  2. https://bips.dev/147/
  3. https://developer.bitcoin.org/devguide/contracts.html?highlight=script
  4. https://dimecore-docs.dimecoinnetwork.com/en/latest/docs/guide/transactions-standard-transactions.html
  5. https://cryptodeeptech.ru/digital-signature-forgery-attack/
  6. https://joncave.co.uk
  7. https://bips.dev/62/
  8. https://forklog.com/en/chaincode-labs-sizes-up-the-quantum-threat-to-bitcoin/
  9. https://blog.blockstream.com/the-risks-of-expressive-smart-contracts-lessons-from-the-latest-ethereum-hack/
  10. https://veronicatee.hashnode.dev/multisignature-transactions-in-bitcoin-an-overview
  11. https://www.blocktrainer.de/en/blog/die-stolperfallen-von-bitcoin-multisig-wallets
  12. https://en.bitcoin.it/wiki/OP_CHECKMULTISIG
  13. https://cointelegraph.com/explained/multisig-cold-wallets-how-secure-are-they-really
  14. https://www.soroushjp.com/2014/12/20/bitcoin-multisig-the-hard-way-understanding-raw-multisignature-bitcoin-transactions/
  15. https://learnmeabitcoin.com/technical/script/p2ms/
  16. https://www.uniblock.dev/blog/what-i-learned-about-hacking-multi-signature-wallets
  17. https://www.nervos.org/knowledge-base/what_is_OPCAT_(explainCKBot)
  18. https://www.totalsig.com/blog/how-multsig-wallet-works
  19. https://cryptorobotics.ai/news/hidden-vulnerabilities-multi-sig-cold-storage-crypto-exchanges/
  20. https://www.nccgroup.com/us/research-blog/a-brief-review-of-bitcoin-locking-scripts-and-ordinals/
  21. https://cronfa.swan.ac.uk/Record/cronfa60178/Download/60178__25491__cf880e484fd94516b2ef2fb9e21cc884.pdf
  22. https://www.cobo.com/post/the-bybit-breach-why-multi-sig-alone-isn-t-enough
  23. https://bitcointalk.org/index.php?topic=5510148.0
  24. https://x.com/alemaz98/status/1897553541142630716
  25. https://cantina.xyz/blog/a-guide-to-multi-sig-security-in-2025-from-simple-exploits-to-system-wide-compromises
  26. https://www.checksig.com/CheckSig-Bitcoin-Custody-Protocol-January-2023.pdf
  27. https://docs.bsvblockchain.org/bsv-academy/introduction-to-bitcoin-script/chapter-4-simple-scripts/04-pay-to-multisig-p2ms
  28. https://www.intelligenttechchannels.com/2025/03/06/how-bybits-multi-signature-crypto-wallet-was-compromised/
  29. https://pkg.go.dev/github.com/btcsuite/btcd/txscript
  30. https://github.com/demining/Digital-Signature-Forgery-Attack
  31. https://bitcointalk.org/index.php?topic=5271566.0
  32. https://en.bitcoin.it/wiki/Weaknesses
  33. https://forum.bits.media/index.php?%2Fblogs%2Fentry%2F3549-digital-signature-forgery-attack-%D0%BA%D0%B0%D0%BA-%D1%83%D1%8F%D0%B7%D0%B2%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D0%B8-cve-2025-29774-%D0%B8-%D0%B1%D0%B0%D0%B3-sighash_single-%D1%83%D0%B3%D1%80%D0%BE%D0%B6%D0%B0%D1%8E%D1%82-%D0%BC%D1%83%D0%BB %D1%8C%D1%82%D0%B8%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D0%BD%D1%8B%D0%BC-% D0%BA%D0%BE%D1%88%D0%B5%D0%BB%D1%8C%D0%BA%D0%B0%D0%BC-%D0%BC%D0%B5%D1%82%D 0%BE%D0%B4%D1%8B-%D0%BE%D0%BF%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D0%B8-%D1%81-% D0%BF%D0%BE%D0%B4%D0%B4%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%BC%D0%B8-rawtx%2F
  34. https://papers.ssrn.com/sol3/Delivery.cfm/SSRN_ID3184130_code2090306.pdf?abstractid=3184130&mirid=1
  35. https://arxiv.org/pdf/2203.03054.pdf
  36. https://arxiv.org/pdf/1706.00916.pdf
  37. https://arxiv.org/html/2507.21085v1
  38. https://docs.bsvblockchain.org/network-topology/nodes/sv-node/chronicle-release
  39. https://en.bitcoin.it/wiki/Script
  40. https://developer.bitcoin.org/devguide/transactions.html?highlight=script
  41. https://academy.binance.com/en/articles/an-introduction-to-bitcoin-script
  42. https://docs.dash.org/tl/stable/docs/core/guide/transactions-transaction-malleability.html
  43. https://bitcointalk.org/index.php?topic=5262177.0
  44. https://en.bitcoin.it/wiki/BIP_0141
  45. https://chemaclass.com/blog/programmable-money/

Scientific sources


  1. https://en.bitcoin.it/wiki/OP_CHECKMULTISIG
  2. https://bips.dev/62/
  3. https://pikabu.ru/story/kak_uyazvimosti_cve202529774_i_bag_sighash_single_ugrozhayut_multipodpisnyim_koshelkam_seti_bitkoin_s_poddelnyimi_rawtx_chast_3_12995204
  4. https://github.com/demining/Digital-Signature-Forgery-Attack
  5. https://cryptodeeptech.ru/digital-signature-forgery-attack/
  6. https://forum.bits.media/index.php?%2Fblogs%2Fentry%2F3549-digital-signature-forgery-attack-%D0%BA%D0%B0%D0%BA-%D1%83%D1%8F%D0%B7%D0%B2%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D0%B8-cve-2025-29774-%D0%B8-%D0%B1%D0%B0%D0%B3-sighash_single-%D1%83%D0%B3%D1%80%D0%BE%D0%B6%D0%B0%D1%8E%D1%82-%D0%BC%D1%83%D0%BB %D1%8C%D1%82%D0%B8%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D0%BD%D1%8B%D0%BC-% D0%BA%D0%BE%D1%88%D0%B5%D0%BB%D1%8C%D0%BA%D0%B0%D0%BC-%D0%BC%D0%B5%D1%82%D 0%BE%D0%B4%D1%8B-%D0%BE%D0%BF%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D0%B8-%D1%81-% D0%BF%D0%BE%D0%B4%D0%B4%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%BC%D0%B8-rawtx%2F
  7. https://keyhunters.ru/hidden-risks-of-multi-signature-bitcoin-wallets-analysis-of-copay-vulnerability-via-sighash_single-attack-digital-signature-forgery-attack-vulnerabilities-such-as-cve-2025-29774-and-cve-2025-29775/
  8. https://delvingbitcoin.org/t/cve-2024-38365-public-disclosure-btcd-findanddelete-bug/1184
  9. https://www.ibm.com/support/pages/node/7238739
  10. https://www.certora.com/blog/bybit-hack-multisig-wallet-security
  11. https://developer.bitcoin.org/devguide/transactions.html?highlight=signature
  12. https://www.zerodayinitiative.com/advisories/published/2023/
  13. https://www.fireblocks.com/blog/mpc-vs-multi-sig/
  14. http://bitcoinwiki.org/wiki/script
  15. https://launchpad.net/ubuntu/jammy/+source/linux/+changelog
  16. https://cryptorobotics.ai/news/hidden-vulnerabilities-multi-sig-cold-storage-crypto-exchanges/
  17. https://ledgerjournal.org/ojs/ledger/article/download/101/93/613
  18. https://cwe.mitre.org/data/definitions/347.html
  19. https://bugs.launchpad.net/bugs/2048183
  20. https://www.bitpay.com/blog/multisig-wallet-security
85bitcoinjs-lib/blob/feat/logo-add/src/payments/p2ms.js
  1. https://coinshares.com/no-en/insights/research-data/burning-quantum-vulnerable-coins-is-a-bad-idea/
  2. https://blog.lopp.net/against-quantum-recovery-of-bitcoin/
  3. https://www.sciencedirect.com/science/article/pii/S2590005621000138
  4. https://coinshares.com/it/insights/research-data/bitcoin-and-the-quantum-computing-risk/
  5. https://postquantum.com/post-quantum/quantum-cryptocurrencies-bitcoin/
  6. https://www.ledger.com/de/academy/crypto-and-quantum-computing

Important links:

  • : Quantum Computing: A Threat to Bitcoin? onesafe
  • : Pay-to-Public-Key-Hash (P2PKH) trezor
  • : Applications of Post-quantum Cryptography arxiv
  • : SEALSQ Quantum-Resistant Technology Tackles Potential Bitcoin’s Quantum Vulnerabilities thequantuminsider
  • : An Introduction to Bitcoin Script academy.binance
  • : Bitcoin address types compared: P2PKH, P2SH, P2WPKH unchained
  1. https://thequantuminsider.com/2024/12/24/sealsq-quantum-resistant-technology-tackles-potential-bitcoins-quantum-vulnerabilities/
  2. https://www.onesafe.io/blog/quantum-computing-bitcoin-security
  3. https://academy.binance.com/da-DK/articles/an-introduction-to-bitcoin-script
  4. https://www.sciencedirect.com/science/article/pii/S2590005621000138
  5. https://trezor.io/learn/advanced/standards-proposals/pay-to-public-key-hash-p2pkh
  6. https://www.unchained.com/blog/bitcoin-address-types-compared
  7. https://arxiv.org/pdf/2406.13258.pdf
  8. https://www.enisa.europa.eu/news/enisa-news/post-quantum-cryptography-anticipating-threats-and-preparing-the-future
  9. https://bitcoincashresearch.org/t/post-quantum-cryptography/845/22
  10. https://archlending.com/blog/bitcoin-address-types
  11. https://github.com/andkom/php-bitcoin-address
  12. https://learnmeabitcoin.com/technical/script/p2pk/
  13. https://github.com/openblockchains/programming-bitcoin-script
  14. https://learnmeabitcoin.com/technical/script/p2pkh/
  15. https://bitcointalk.org/index.php?topic=2605402.0
  16. https://komodoplatform.com/en/academy/p2pk-pay-to-pubkey/
  17. https://mindweb.hashnode.dev/locking-and-unlocking-scripts-in-bitcoin
  18. https://komodoplatform.com/en/academy/p2pkh-pay-to-pubkey-hash/
  19. https://learnmeabitcoin.com/technical/transaction/output/scriptpubkey/
  1. https://www.onesafe.io/blog/quantum-computing-bitcoin-security
  2. https://bitcoinmagazine.com/technical/quantum-computing-and-bitcoin-security
  3. https://coinshares.com/it/insights/research-data/bitcoin-and-the-quantum-computing-risk/
  4. https://www.ledger.com/de/academy/crypto-and-quantum-computing
  5. https://postquantum.com/post-quantum/quantum-cryptocurrencies-bitcoin/
  6. https://cointelegraph.com/news/quantum-computing-satoshi-bitcoin-vulnerability
  7. https://academy.binance.com/en/articles/an-introduction-to-bitcoin-script
  8. https://discovery.ucl.ac.uk/id/eprint/10063353/1/iacr.pdf
  9. https://www.reddit.com/r/crypto/comments/120uiop/does_publishing_a_public_key_lower_the_security/
  10. https://www.nccgroup.com/us/research-blog/a-brief-review-of-bitcoin-locking-scripts-and-ordinals/
  11. https://www.sealsq.com/investors/news-releases/sealsq-quantum-resistant-technology-tackles-potential-bitcoins-quantum-vulnerabilities
  12. https://forklog.com/en/chaincode-labs-sizes-up-the-quantum-threat-to-bitcoin/
  13. https://blog.lopp.net/against-quantum-recovery-of-bitcoin/
  14. https://learnmeabitcoin.com/technical/script/p2pk/
  15. https://www.certik.com/resources/blog/private-key-public-risk
  16. https://river.com/learn/terms/p/p2pk/
  17. https://komodoplatform.com/en/academy/p2pkh-pay-to-pubkey-hash/
  18. https://komodoplatform.com/en/academy/p2pk-pay-to-pubkey/
  19. https://trezor.io/learn/advanced/standards-proposals/pay-to-public-key-hash-p2pkh
  20. https://github.com/openblockchains/programming-bitcoin-script
  21. https://blog.coinshares.com/quantum-securing-bitcoin-really-isnt-that-hard-250d16157cb9
  22. https://bitcointalk.org/index.php?topic=5465605.0
  23. https://bglaw.eu/articles/is-your-bitcoin-wallet-safe-from-the-quantum-threat/
  24. https://docs.bsvblockchain.org/bsv-academy/introduction-to-bitcoin-script/chapter-4-simple-scripts/01-pay-to-public-key-p2pk
  25. https://www.fireblocks.com/blog/how-blockchains-will-evolve-for-the-quantum-era/
  26. https://coinshares.com/no-en/insights/research-data/burning-quantum-vulnerable-coins-is-a-bad-idea/
  27. https://www.sciencedirect.com/science/article/pii/S2590005621000138
  28. https://www.nadcab.com/blog/bitcoin-script
  29. https://forklog.com/en/quantum-computers-could-crack-bitcoin-in-five-years-scientist-warns/
  30. https://papers.ssrn.com/sol3/Delivery.cfm/5324094.pdf?abstractid=5324094&mirid=1

Sources:

  • : Coinshares, “Bitcoin & The Quantum Computing Risk” coinshares
  • : SEALSQ Quantum-Resistant Technology sealsq
  • : Chaincode Labs sizes up the quantum threat to Bitcoin forklog
  • : Ledger, Bitcoin And Quantum Computing ledger
  • : Fireblocks, Quantum Era and Bitcoin fireblocks
  • : Sciencedirect, Blockchain quantum attacks sciencedirect
  • : Royal Society Publishing, Quantum resistance for Bitcoin royalsocietypublishing
  • : CVE-2023-33242 fireblocks
  • : Reddit, Quantum computing and cracking bitcoin-signatures reddit
  1. https://coinshares.com/it/insights/research-data/bitcoin-and-the-quantum-computing-risk/
  2. https://www.fireblocks.com/blog/how-blockchains-will-evolve-for-the-quantum-era/
  3. https://cointelegraph.com/explained/why-a-hacker-turned-ceo-believes-quantum-tech-could-break-bitcoin
  4. https://www.sealsq.com/investors/news-releases/sealsq-quantum-resistant-technology-tackles-potential-bitcoins-quantum-vulnerabilities
  5. https://www.ledger.com/de/academy/crypto-and-quantum-computing
  6. https://www.sciencedirect.com/science/article/pii/S2590005621000138
  7. https://royalsocietypublishing.org/doi/10.1098/rsos.180410
  8. https://www.lrqa.com/en/cyber-labs/flaw-in-putty-p-521-ecdsa-signature-generation-leaks-ssh-private-keys/
  9. https://www.fireblocks.com/blog/lindell17-abort-vulnerability-technical-report/
  10. https://www.reddit.com/r/crypto/comments/1c54e1h/cve202431497_secret_key_recovery_of_nist_p521/
  11. https://forklog.com/en/chaincode-labs-sizes-up-the-quantum-threat-to-bitcoin/
  12. https://www.reddit.com/r/Buttcoin/comments/1mjtxrk/quantum_computing_and_cracking_bitcoinsignatures/
  13. https://www.enisa.europa.eu/news/enisa-news/post-quantum-cryptography-anticipating-threats-and-preparing-the-future
  14. https://arxiv.org/pdf/2406.13258.pdf
  15. https://komodoplatform.com/en/academy/p2pk-pay-to-pubkey/
  16. https://research.kudelskisecurity.com/2023/03/06/polynonce-a-tale-of-a-novel-ecdsa-attack-and-bitcoin-tears/
  17. https://www.reddit.com/r/CryptoCurrency/comments/r6o2vq/satoshis_1_million_bitcoin_will_be_hacked/
  18. https://polynonce.ru/analyzing-malleable-signatures-and-key-exposure-risks-in-bitcoins-ecdsa-protocol/
  19. https://jfrog.com/blog/cve-2022-21449-psychic-signatures-analyzing-the-new-java-crypto-vulnerability/
  20. https://github.com/topics/ecdsa-cryptography?l=html&o=asc
  21. https://www.sciencedirect.com/science/article/abs/pii/S0167739X17330030

Line 40 of the code return a.output.slice(1, -1);  is the public key extraction point, which creates a direct path for quantum attacks on the ECDSA cryptography used in Bitcoin.

The diagram clearly shows why this vulnerability requires immediate attention from the cryptographic community and Bitcoin protocol developers.

 Cryptanalysis