Skip to content

bakaxbaka/SignatureFixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

103 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” SignatureFixer
Comprehensive Bitcoin Signature Analyzer Β· Vulnerability Scanner Β· DER Malleability Lab

SignatureFixer is a full-stack Bitcoin signature-forensics platform designed to audit Bitcoin transactions for vulnerabilities, signature malleability, key-reuse dangers, wallet implementation flaws, and malformed DER encodings.

Safety first: this project is for educational auditing only. It never handles private keys, enforces size-limited hex parsing, and now logs requests and errors via structured Pino logging so operational teams can spot abuse.

     ⸜(q˃ α΅• Λ‚ )⸝ Buy me a coffee : 1PmAFZaBpokiMZ8TxhwMBW78s4Y1U9mEwK ⸜(q˃ α΅• Λ‚ )⸝
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚        Frontend UI         β”‚
                     β”‚  React / Vite / TypeScript β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                     User Input     β”‚     JSON Responses
                                    β”‚
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚         Express API         β”‚
                     β”‚       /api/* Endpoints      β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β”‚  Calls Services
                                    β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚                        BACKEND SERVICE LAYER                     β”‚
 β”‚                                                                  β”‚
 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
 β”‚  β”‚  Multi-Endpoint       β”‚   β”‚   Tor + Cache Layer           β”‚   β”‚
 β”‚  β”‚  Blockchain Fetcher   β”‚   β”‚ - Rate limit smoothing        β”‚   β”‚ 
 β”‚  β”‚ - blockstream.info    β”‚   β”‚ - Memory + Disk cache         β”‚   β”‚
 β”‚  β”‚ - mempool.space       β”‚   β”‚ - Tor SOCKS5 optional         β”‚   β”‚
 β”‚  β”‚ - blockchain.info     β”‚   β”‚ - Retry + backoff             β”‚   β”‚
 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
 β”‚                β”‚                           β”‚                     β”‚
 β”‚                β”‚ TX Hex + JSON Data        β”‚ Cached / Tor-Fixed  β”‚
 β”‚                β–Ό                           β–Ό                     β”‚
 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
 β”‚  β”‚   Raw Transaction Decoder   β”‚   β”‚   UTXO Reconstruction   β”‚   β”‚
 β”‚  β”‚ - version / locktime        β”‚   β”‚ - find inputs/outputs   β”‚   β”‚
 β”‚  β”‚ - inputs / outputs          β”‚   β”‚ - mark spent/unspent    β”‚   β”‚
 β”‚  β”‚ - script extraction         β”‚   β”‚ - change detection      β”‚   β”‚
 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
 β”‚                β”‚                                 β”‚               β”‚
 β”‚                β”‚ Signatures / Scripts            β”‚ UTXO Context  β”‚
 β”‚                β–Ό                                 β–Ό               β”‚
 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
 β”‚  β”‚  Signature Extraction Engine β”‚   β”‚      Sighash Builder     β”‚ β”‚
 β”‚  β”‚ - r / s / sighash byte       β”‚   β”‚ - Legacy (P2PKH)         β”‚ β”‚
 β”‚  β”‚ - pubkey parsing             β”‚   β”‚ - SegWit (BIP143)        β”‚ β”‚
 β”‚  β”‚ - script type detection      β”‚   β”‚ - Nested SW              β”‚ β”‚
 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
 β”‚                β”‚                                 β”‚               β”‚
 β”‚                β”‚ Parsed Signature Data           β”‚ Preimages     β”‚
 β”‚                β–Ό                                 β–Ό               β”‚
 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
 β”‚  β”‚        DER/BER Engine       β”‚   β”‚    Malleability Engine    β”‚ β”‚
 β”‚  β”‚ - Strict DER (Bitcoin Core) β”‚   β”‚ - High‑S transform        β”‚ β”‚
 β”‚  β”‚ - Loose DER (elliptic bug)  β”‚   β”‚ - BER padding             β”‚ β”‚
 β”‚  β”‚ - Range validation          β”‚   β”‚ - Bad length fields       β”‚ β”‚
 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
 β”‚                β”‚                                 β”‚               β”‚
 β”‚                β”‚ Valid / Invalid DER             β”‚ Malleated Sig β”‚
 β”‚                β–Ό                                 β–Ό               β”‚
 β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
 β”‚   β”‚   Library Verification     β”‚  β”‚    CVE‑2024‑42461 Tester  β”‚  β”‚
 β”‚   β”‚ - elliptic                 β”‚  β”‚- Generate 15+ BER variantsβ”‚  β”‚
 β”‚   β”‚ - noble-secp256k1          β”‚  β”‚- Cross‑library verify     β”‚  β”‚
 β”‚   β”‚ - bitcoinjs-lib            β”‚  β”‚- Produce vulnerability mapβ”‚  β”‚
 β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
 β”‚                 β”‚                                  β”‚             β”‚
 β”‚                 β”‚ Verification Matrix               β”‚ CVE Report β”‚
 β”‚                 β–Ό                                  β–Ό             β”‚
 β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
 β”‚   β”‚     Wycheproof Runner      β”‚   β”‚ Vulnerability Scoring     β”‚ β”‚
 β”‚   β”‚ - load vectors             β”‚   β”‚ - r reuse                 β”‚ β”‚
 β”‚   β”‚ - run full suite           β”‚   β”‚ - high-S detection        β”‚ β”‚
 β”‚   β”‚ - detect invalid accepted  β”‚   β”‚ - sighash anomalies       β”‚ β”‚
 β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
 β”‚                 β”‚                                  β”‚             β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚                                  β”‚
                   β–Ό                                  β–Ό
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚ Structured JSON  β”‚             β”‚  UI Visualization      β”‚
          β”‚ (Analysis Result)β”‚             β”‚ (Tables, Charts, Flags)β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Installation & Run Install npm install npm run build Dev mode npm run dev Run Backend Only npm run server Run Tests npm test πŸ”₯ What This System Provides

Feature Status Description

Raw TX Inspector βœ… Decode, analyze, extract sigs

DER/BER Parser βœ… Strict + Loose modes

CVE‑2024‑42461 Detector βœ… Auto‑test libraries for ASN.1 bug

Wycheproof Integration βœ… Full compliance testing

Multi‑Curve βœ… secp256k1 + secp521r1

Malleability Engine βœ… High‑S, BER padding, garbage bytes

Sighash Visualizer βœ… BIP143 + legacy

Hardened DER Rules βœ… Bitcoin‑Core canonicality

CI Security Tests βœ… Prevent regression

image image

πŸ“Œ Features Overview

🟦 1. Multi-Endpoint Blockchain Fetcher

SignatureFixer uses four blockchain explorers, automatically switching on rate limits:

  1. blockchain.info
  2. blockstream.info
  3. mempool.space
  4. blockcypher.com

Features:

  • Automatic fallback on errors or HTTP 429
  • Tor-proxy support
  • Normalization into a single unified format
  • Full transaction fetching including inputs, outputs, scripts, witness, etc.
  • Optional TX hex fetching from multiple providers
image

🟩 2. Tor Rotating Fetcher (Optional)

A custom HTTP client routed through Tor SOCKS5 proxy:

  • socks5h://127.0.0.1:9050
  • Infinite retry
  • Exponential backoff
  • Global request throttle
  • Disk + memory cache
  • 429-proof data fetching

🟧 3. Caching Layer

All external calls pass through the internal caching mechanism:

  • Memory cache (5–10 min TTL)
  • Disk cache (/data/http_cache.json)
  • Reduces API calls by 70–90%
  • Instant retries from cache on API blackout

🟨 4. Transaction Hex Retrieval (Multi-Source)

getTxHex(txid) tries:

  1. Blockchain.info (?format=hex)
  2. Blockstream (/tx/:id/hex)
  3. Mempool.space (/tx/:id/hex)
  4. BlockCypher (includeHex=true)

Always returns canonical raw hexadecimal transaction.

image

πŸŸͺ 5. DER Signature Extraction

Supports:

βœ” P2PKH (scriptSig)

βœ” P2WPKH (witness stack)

βœ” P2SH-wrapped SegWit

βœ” Multisig (m-of-n, multi-signatures)

Extracts:

  • r
  • s
  • sighash
  • public key
  • input index
  • script type
  • corresponding UTXO
image image image

πŸŸ₯ 6. DER Parser

Strict ASN.1 DER decoding: Detects:

  • Incorrect SEQUENCE length
  • Overlong encodings
  • Short encodings
  • Negative INTEGERs
  • Non-canonical DER
  • Zero-padding errors
image

🟦 7. DER Malleability Playground

SignatureFixer includes a live interactive DER signature mutation lab:

Generate:

  • High-S variant
  • Extra leading zero in r
  • Extra leading zero in s
  • Wrong SEQUENCE length
  • Structural corruption
  • Trailing garbage bytes

And test:

Does the ECDSA library incorrectly accept malformed signatures?

Includes:

  • Elliptic.js verification backend
  • Expected vs. actual acceptance
  • Automatic bug detection

🟫 8. Z-Hash Reconstruction (Signature Message Hash)

Supports all hashing modes:

  • Legacy P2PKH
  • SegWit P2WPKH (BIP143)
  • Nested SegWit
  • Taproot (coming soon)

Rebuilds:

  • Serialized transaction
  • Preimage
  • Double SHA256
  • z digest used in ECDSA

🟩 9. UTXO Reconstruction Engine

Builds full UTXO set for any address:

  • Finds all outputs associated with the address
  • Tracks spending transactions
  • Marks spent/unspent
  • Detects self-spends
  • Required for vulnerability testing

🟫 10. Vulnerability Detection

SignatureFixer checks for:

πŸ”₯ 1. Nonce reuse

Identical r value across two signatures β†’ PRIVATE KEY RECOVERABLE

πŸ”₯ 2. High-S / Low-S anomalies

Detects poor signing library behavior

πŸ”₯ 3. Script type detection

(P2PKH vs P2WPKH vs P2SH)

πŸ”₯ 4. Bad sighash bytes

Flags anything non-01

πŸ”₯ 5. Weak r patterns

Entropy tests, repeating prefixes

πŸ”₯ 6. Multi-input same-pubkey signature correlation

Same pubkey signing multiple inputs β†’ local nonce correlation analysis


πŸŸ₯ 11. Wycheproof Integration

Allows:

  • Running Google's Wycheproof ECDSA test vectors
  • Checking whether your ECDSA implementation accepts invalid signatures
  • Detecting broken or malleable crypto libraries
  • Running malformed DER corpora

Supports:

  • ecdsa_secp256k1_sha256_test.json
  • ed25519_test.json
  • and more

🟦 12. Parallel Scanning Engine

Scan hundreds of Bitcoin addresses safely:

  • Concurrency-limited queue
  • Tor-aware global throttling
  • Memory/disk caching
  • Per-address UTXO reconstruction
  • Per-transaction signature analysis

πŸ“₯ Installation

1. Clone

git clone https://github.com/bakaxbaka/SignatureFixer
cd SignatureFixer
2. Install dependencies
bash
npm install
3. (Optional) Install + run Tor
bash
sudo apt install tor
tor &
4. Run development server
bash
npm run dev
Backend runs on Express, frontend on React/Vite.

Releases

No releases published

Packages

 
 
 

Contributors

Languages