Dev.to Security πŸ” Cybersecurity πŸ‘ 2 πŸ“– 4 min read

Auditing Exposed secp256k1 Bitcoin/EVM Public Keys & Fixing What Breaks When Enabling OpenSSH/Git PQC

Between the December 2 NSA/CISA/ONCD PQC advisory and five simultaneous Hacker News front-page threads over the last 24 hours on ECC P-256, SSH/PGP key upgrades, and "What broke when I enabled PQC for Git and SSH", a lot

Between the December 2 NSA/CISA/ONCD PQC advisory and five simultaneous Hacker News front-page threads over the last 24 hours on ECC P-256, SSH/PGP key upgrades, and "What broke when I enabled PQC for Git and SSH", a lot of developers are running hygiene audits across both their crypto treasuries and their SSH/TLS/JWT infrastructure this weekend.

Ignoring panic and hype, there are two completely concrete, verifiable engineering checks every developer can run in 60 seconds:

  1. Which of your crypto addresses already have a raw elliptic-curve public key exposed on-chain?
  2. How do you turn on hybrid Post-Quantum key exchange (mlkem768x25519-sha256) in OpenSSH & Nginx without breaking legacy git push hosts?

Part 1: On-Chain Raw Public-Key Exposure Matrix (Read-Only Facts)

Different chains expose public keys under very different rules:

Chain / Address Type Hash-Protected Before Spend? When Raw Public Key Becomes Permanently Visible On-Chain
Bitcoin bc1q... (P2WPKH) / 1... (P2PKH) Yes (HASH160) After the very first outbound spend (spent_txo_count > 0, i.e. address reuse). Fresh unspent bc1q addresses keep the pubkey hidden.
Bitcoin bc1p... (Taproot / P2TR) & Legacy P2PK No Immediately upon receiving funds β€” Taproot encodes the tweaked 32-byte x-only secp256k1 pubkey directly in the output script.
Ethereum / Base / Arbitrum / Polygon EOA (0x...) Yes (keccak256) After the very first outbound tx (eth_getTransactionCount > 0) β€” any ECDSA signature (v, r, s) allows anyone to recover the raw secp256k1 pubkey forever via ecrecover.
Solana (Ed25519) No Immediately from Day 1 β€” every Solana address is its raw 32-byte Ed25519 public key.

Zero-Dependency Read-Only Multi-Chain Exposure Check (TypeScript)

You never need to connect a wallet or sign a message to check exposure. Both mempool.space and PublicNode EVM RPCs support public read-only queries directly:

// 100% read-only exposed-pubkey hygiene audit (zero wallet-connect, zero API keys)
export async function auditBitcoinPubkeyExposure(addr: string) {
  const res = await fetch(`https://mempool.space/api/address/${addr}`);
  const data = await res.json();
  const spentCount = data.chain_stats?.spent_txo_count ?? 0;
  const balanceBtc =
    ((data.chain_stats?.funded_txo_sum ?? 0) - (data.chain_stats?.spent_txo_sum ?? 0)) / 1e8;

  if (addr.startsWith("bc1p")) {
    return { addr, type: "P2TR (Taproot)", exposed: true, risk: "HIGH", balanceBtc, reason: "Tweaked secp256k1 x-only pubkey is directly in output script" };
  }
  if (spentCount > 0) {
    return { addr, type: "Reused BTC Address", exposed: true, risk: "HIGH", balanceBtc, reason: `${spentCount} outbound spend(s) already revealed raw secp256k1 pubkey in scriptSig/witness` };
  }
  return { addr, type: "Unspent Hash-Locked", exposed: false, risk: "LOW", balanceBtc, reason: "Public key remains behind HASH160 until first spend" };
}

export async function auditEvmNonceExposure(addr: string, rpcUrl = "https://ethereum-rpc.publicnode.com") {
  const rpc = (method: string, params: unknown[]) =>
    fetch(rpcUrl, {
      method: "POST",
      headers: { "content-type": "application/json" },
      body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
    }).then((r) => r.json());

  const [nonceRes, codeRes] = await Promise.all([
    rpc("eth_getTransactionCount", [addr, "latest"]),
    rpc("eth_getCode", [addr, "latest"]),
  ]);
  const nonce = parseInt(nonceRes.result || "0x0", 16);
  const isContract = Boolean(codeRes.result && codeRes.result !== "0x");

  return {
    addr,
    isContract,
    nonce,
    pubkeyExposed: !isContract && nonce > 0,
    recommendation:
      !isContract && nonce > 0
        ? "Cold funds with nonce > 0 can be swept into a fresh zero-nonce EOA or Safe smart account that never signs outbound txs."
        : "No EOA ECDSA signature exposed on this chain.",
  };
}

Part 2: Enabling OpenSSH 9.9+ Hybrid PQC Without Breaking git push

A common trap engineers hit this week when tightening ~/.ssh/config was restricting KexAlgorithms exclusively to mlkem768x25519-sha256 (OpenSSH 9.9+ default) β€” which immediately broke older Git forges, CI runners, and bastion hosts running OpenSSH 8.x/9.x with:

Unable to negotiate with <host> port 22: no matching key exchange method found.

Instead, order hybrid PQC first with clean classical fallback, retire legacy ecdsa-sha2-nistp256 / ssh-rsa identities in favor of ssh-ed25519, and isolate legacy hosts explicitly:

# ~/.ssh/config β€” OpenSSH 9.9+ hybrid PQC first, zero Git breakage
Host *
  KexAlgorithms mlkem768x25519-sha256,[email protected],curve25519-sha256,[email protected]
  HostKeyAlgorithms ssh-ed25519,rsa-sha2-512,rsa-sha2-256
  PubkeyAcceptedAlgorithms ssh-ed25519,rsa-sha2-512,rsa-sha2-256
  IdentitiesOnly yes

# Example per-host override ONLY if a specific legacy CI/Git host lacks hybrid KEX
Host legacy-git.internal
  KexAlgorithms curve25519-sha256,[email protected]

And for Nginx (OpenSSL 3.5+) hybrid TLS 1.3 key exchange:

ssl_protocols TLSv1.3;
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;

Finally, check your local ~/.ssh directory in one command for legacy P-256 (ECDSA) or weak RSA keys:

for f in ~/.ssh/*.pub; do ssh-keygen -lf "$f"; done | grep -E "ECDSA|DSA|1024|2048"

Free 100% Client-Side Multi-Chain & SSH/JWT PQC Auditor + Official MCP Server

We built QuantumVault β€” a 100% client-side, read-only scanner (never asks for wallet-connect or private keys!) covering Bitcoin (mempool.space) + Ethereum / Base / Arbitrum / Polygon (PublicNode RPCs) + Solana + local SSH/Nginx/JWT ES256 config auditing:

(Disclosure: single-address multi-chain exposure audits, SSH/Nginx/JWT checks, and the MIT MCP/CLI are completely free. Optional $9 multi-wallet portfolio reports and $29 complete PQC + cold-sweep config packs fund maintenance.)

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.