# PQC Exposure Audit Protocol (`pqc-exposure-audit/v1`)

Factual, neutral audit specification based on the December 2026 Post-Quantum Cryptography landscape.
Humans and automated coding/security agents can use this document to evaluate an organization's real-world exposure across encryption, authentication, PKI, runtimes, and migration deadlines.

---

## 1. Instructions for Automated Agents & LLMs

When a user provides this URL and asks you to evaluate their systems, repositories, cloud configuration, or infrastructure:

1. **Stay read-only first.** Inspect configurations, dependency manifests, TLS/SSH endpoints, certificate chains, headers, and database schemas without modifying files or mutating production settings.
2. **Never print or exfiltrate secrets.** Do not output private keys, API tokens, raw passwords, or session cookies. Report metadata (algorithm names, key sizes, library versions, byte limits, and file paths) only.
3. **Verify rather than guess.** Label every finding as `OBSERVED` (backed by a file line, command output, or TLS probe), `INFERRED`, or `NOT CHECKED` (when a system is unreachable).
4. **Stay factual and neutral.** Avoid alarmist or opinionated framing. Explain concrete failure modes and regulatory/vendor dates strictly as documented.
5. **Present a dyslexia-friendly output.** Lead with short plain-English bullets, keep paragraphs concise (3 lines or fewer), include a compact status table, and highlight the most urgent actions first.

---

## 2. Factual Late-2026 PQC Reference Baseline

### Finalized & Active Standards
- **FIPS 203 (`ML-KEM`)** — Primary Module-LWE key encapsulation for key establishment (finalized Aug 2024; `ML-KEM-768` NIST general default; `ML-KEM-1024` required by CNSA 2.0). Hybrid TLS 1.3 (`X25519MLKEM768`, **RFC 10024**) already protects ~73% of human browser TLS connections traversing Cloudflare; OpenSSH 10.x defaults to `mlkem768x25519-sha256` (**RFC 10042**).
- **FIPS 204 (`ML-DSA`)** — Primary stateless Module-LWE/SIS digital signature (`ML-DSA-44` Cat 2, `ML-DSA-65` Cat 3 general default, `ML-DSA-87` Cat 5 CNSA 2.0). X.509 encoding in **RFC 9881** (requires pure ML-DSA without pre-hash `HashML-DSA` and recommends 32-byte seeds); JOSE/COSE encoding in **RFC 9964**.
- **FIPS 205 (`SLH-DSA`)** — Stateless hash-based backup signature scheme (`SPHINCS+`, RFC 9909). Draft **SP 800-230** (Apr 2026) adds 2^24-signature capped parameter sets reducing Category 1 signatures from 7,856 B to ~3.8 KB.
- **NIST SP 800-208 (`LMS` / `XMSS`)** — Stateful hash-based firmware and code signing (approved in CNSA 2.0; requires strict non-exportable FIPS 140 L3+ HSM monotonic leaf tracking per **RFC 10033**).
- **NIST SP 800-227** (Sep 2025) — Key-encapsulation guidelines and approved hybrid key combiners.
- **NIST CSWP 39** (upd. Jun 2026) — Crypto-agility architecture recommendations.
- **ISO/IEC 18033-2:2006/Amd 2:2026** (Jun 2026) — Standardized **ML-KEM**, **FrodoKEM** (unstructured plain-LWE, recommended by BSI/ENISA at Levels 3 and 5), and **Classic McEliece** (binary Goppa codes).
- **Pending Standards:** **HQC** (selected Mar 2025 via NIST IR 8545 as code-based KEM backup, FIPS expected 2027); **FN-DSA / FALCON** (planned FIPS 206, undergoing fixed-point redesign for FPU side-channel safety); **NIST Round 3 On-Ramp** (8 non-lattice signature candidates remaining as of late 2026, not approved for production).

### Late-2026 AI Cryptanalysis Context
- **July 29, 2026:** NIST Round 3 lattice candidate **HAWK** was withdrawn after an AI-assisted key-recovery attack reduced HAWK-512 cost from 2^150 to <= 2^108.
- **November 30, 2026:** Anthropic published four theoretical papers (with a machine-checked Lean 4 formalization), including a "galactic" quasi-polynomial quantum algorithm (`n^(poly(k) log n)`) against structured module lattices and stronger worst-case proofs supporting **unstructured** lattices such as FrodoKEM.
- **CIRG Assessment (21 cryptographers):** Concluded the attack requires well beyond **2^1000 quantum operations** on the smallest NIST parameter sets (`ML-KEM-512`, `ML-DSA-44`) because NIST scales rank `k` with ring degree `n = 256` fixed (along `k`, cost still grows exponentially).
- **Operational Guidance (Dec 2, 2026 — NSA PP-26-4956, ONCD/NSA/CISA, 8-company joint statement):** Do **not** pause PQC migration. Pair hybrid key exchange (`X25519MLKEM768` / `SecP384r1MLKEM1024`), favor higher parameter ranks where tolerated, inventory algorithms, and maintain swap readiness to non-lattice families (**HQC**, **SLH-DSA**, **FrodoKEM**).

### Global Timeline Milestones (2026–2035)
- **Jan 1, 2027:** NSA CNSA 2.0 requirement takes effect for all new U.S. National Security System acquisitions.
- **2027:** Let's Encrypt production **Merkle Tree Certificates (MTCs)**, Cloudflare Q1 MTC / Q2 PQ JWT-TLS-SSH / end-2027 full PQC (*Project Quantum Leap*), HQC FIPS target.
- **2028:** UK NCSC discovery and migration planning cutoff; Google Cloud digital signatures & attestations target.
- **2029:** Google and Microsoft full PQC convergence targets (a year before NIST deprecation).
- **2030:** **NIST IR 8547** deprecates all quantum-vulnerable public-key algorithms (`RSA`, `ECDSA`, `EdDSA`, `ECDH`, `FFDH` including RSA-3072, P-256, Ed25519) after 2030; **EO 14412 / OMB M-26-15** mandates PQC key establishment for federal High Value Assets by Dec 31, 2030; **EU NIS** high-risk use cases & default PQC firmware updates by end-2030.
- **2031:** **EO 14412 / OMB M-26-15** mandates PQC digital signatures by Dec 31, 2031; **UK NCSC** highest-priority upgrades due Jan 1, 2031.
- **2035:** **NIST IR 8547**, **EU**, **UK NCSC**, and **CNSA 2.0** full disallowance / retirement of all quantum-vulnerable public-key cryptography (hybrid key establishment remains FIPS 140-validatable past 2035 if at least one component is approved).

---

## 3. Five-Domain Exposure Audit Playbook

Run every applicable check below against the user's environment.

### Domain A: Transit & Edge Key Exchange (HNDL Exposure)
Target: Eliminate classical-only key exchange that exposes traffic to "Harvest Now, Decrypt Later" collection.
- **Check A1 (Public & Edge TLS):** Probe public endpoints (`sslyze 7.0 --supported_groups`, `testssl.sh`, `openssl s_client`) for `X25519MLKEM768` (RFC 10024) or `SecP384r1MLKEM1024`.
- **Check A2 (CDN-to-Origin & Internal Hops):** Explicitly check CDN-to-origin links, load balancers, service meshes, LDAPS, RadSec, syslog-over-TLS, firewalls, and management GUIs—not just the public CDN edge.
- **Check A3 (SSH Fleet):** Check SSH servers and bastions (`ssh -v` / `sshd -T`) for OpenSSH >= 10.0 defaulting to `mlkem768x25519-sha256` (RFC 10042) and check `WarnWeakCrypto` telemetry logs.
- **Check A4 (IKEv2 / VPNs):** Inspect VPN gateways for hybrid ML-KEM IKEv2 support (RFC 9370 + `draft-ietf-ipsecme-ikev2-mlkem`) and middlebox MSS handling (`SecP384r1MLKEM1024` `ServerHello` reaches ~1,755 B, exceeding the 1,460 B IPv4 Ethernet MSS / 1,440 B IPv6).

### Domain B: Codebase, Runtimes & CycloneDX 1.6 CBOM
Target: Establish an evidence-based Cryptographic Bill of Materials rather than assuming dependency defaults.
- **Check B1 (Cryptographic Libraries & Runtimes):** Audit versions against PQC support thresholds:
  - OpenSSL >= 3.5 (Apr 2025)
  - Go >= 1.27 (Aug 2026)
  - `rustls` >= 0.23.44 via `aws-lc-rs`
  - Node.js >= 24.7.0 (`panva/jose` v6.x for ML-DSA JWS)
  - Java JDK 25 LTS / JDK 27 (JEP 452/496/497 KEM & ML-DSA APIs)
  - Apple OS 26 CryptoKit (`JWTKit` 5.3.0)
- **Check B2 (Static & Artifact Discovery):** Inspect source repos (e.g., Semgrep, CodeQL) and containers/dependencies (Trivy, Syft) for hardcoded RSA/ECDSA OIDs, P-256/Ed25519 keys, or missing hybrid KEM support.
- **Check B3 (CBOM Completeness):** Confirm whether a versioned **CycloneDX 1.6 CBOM** exists recording algorithms, parameter sets, standards track (NIST FIPS vs. ISO), data confidentiality shelf-life (`X`), and system owners—with private keys strictly excluded.
- **Check B4 (Mosca's Inequality Triage):** For each asset, evaluate `X + Y > Z` (`X` = data secrecy shelf-life in years, `Y` = expected migration duration in years, `Z` = estimated years until a CRQC). Classify Wave 1 (secrecy past 2030, High Value Assets, >5-year firmware roots), Wave 2 (PKI, IAM, SSH), and Wave 3 (short-lived low sensitivity).

### Domain C: Authentication Bloat & Protocol Ceilings
Target: Prevent silent breakage when 64-byte ECDSA signatures expand 38×–78× under ML-DSA.
*Size Reference (Raw -> Base64url):*
- `ECDSA P-256 (ES256)`: 64 B raw -> 86 chars (~939 B JWT with 600 B JSON payload)
- `ML-DSA-44`: 2,420 B raw -> 3,227 chars (~4,080 B JWT)
- `ML-DSA-65`: 3,309 B raw -> 4,412 chars (~5,265 B JWT)
- `ML-DSA-87`: 4,627 B raw -> 6,170 chars (~7,023 B JWT)
- `SLH-DSA-128s`: 7,856 B raw -> 10,475 chars (~11,328 B JWT)

Audit these concrete choke points:
- **Check C1 (Browser Cookies):** Flag any architecture storing signed JWTs inside `Set-Cookie`. **RFC 6265** caps cookies around **4,096 B**—an `ML-DSA-65` signature alone (4,412 chars) exceeds this limit and browsers silently drop the cookie with zero client error telemetry. Remedy: Backend-for-Frontend opaque reference tokens in cookies.
- **Check C2 (Reverse Proxies & HTTP/2):** Inspect Nginx (`large_client_header_buffers`, default `4 8k` caps any single `Authorization` header at 8 KB), WAFs, ALBs, and HTTP/2 `SETTINGS_HEADER_TABLE_SIZE` (HPACK default 4,096 B).
- **Check C3 (IIS & SAML Redirects):** Check IIS `maxQueryString` (2,048 B default) and `maxUrl` (4,096 B default). Flag SAML HTTP-Redirect bindings or signed URLs for migration to HTTP-POST or OIDC (**RFC 9964** `AKP` JWK keys). Symmetric HMAC JWTs (`HS256`) are unaffected by Shor's algorithm.
- **Check C4 (Database Columns):** Search SQL/ORM schemas for tight fixed signature/key columns (`binary(64)`, `varbinary(128)`, small `varchar`) that truncate 2,420–7,856 B signatures or 1,312–2,592 B public keys, and watch 8 KiB page boundaries.
- **Check C5 (WebAuthn / FIDO2):** Verify relying parties accept WebAuthn Level 3 COSE IDs `-48`, `-49`, `-50` via configuration while noting commercial FIDO hardware keys from major platform vendors have not shipped production PQ firmware as of late 2026.

### Domain D: PKI, Certificate Chains & Signing Lifecycles
Target: Separate private PKI migration from public WebPKI Merkle Tree Certificate readiness.
- **Check D1 (TLS Handshake Flight Size):** Flag public TLS plans proposing full 5-signature post-quantum X.509 chains (~20.4 KB sigs / ~22.2 KB flight for ML-DSA-65), which exceed TCP **IW10 (14,600 B)** and QUIC **3× anti-amplification (~3,600–7,200 B)** and fail middleboxes >10 KB. Confirm ACME / CDN plans support **Merkle Tree Certificates (MTCs)** (<1 KB proof) targeting Q1–Q3 2027 browser roots.
- **Check D2 (Private PKI & Mutual TLS):** Verify internal CAs and mTLS chains plan RFC 9881 pure ML-DSA (avoiding `HashML-DSA` in certificates) or RFC 10073 composite ML-DSA where dual-assurance policy applies.
- **Check D3 (Firmware & Hardware Roots of Trust):** Check UEFI/device/OT signing. Verify HSMs support FIPS 203/204/205 and/or SP 800-208 (`LMS`/`XMSS`) inside non-exportable FIPS 140 Level 3+ hardware enforcing monotonic leaf counters (**RFC 10033**) — never software snapshots or exportable state.

### Domain E: Crypto-Agility & Resilience
Target: Ensure algorithms can be rotated in policy rather than application code.
- **Check E1 (Centralized Intent-Based APIs):** Confirm applications request cryptographic intent ("encrypt", "sign") from a centralized provider layer rather than hardcoding OIDs or byte lengths.
- **Check E2 (Downgrade Prevention & Algorithm Diversity):** Verify negotiation disables classical-only fallbacks once peer PQC coverage is verified, and document swap paths to non-lattice backups (`HQC`, `SLH-DSA`, `FrodoKEM`).

---

## 4. Standardized Audit Output Template

When delivering your audit to the user, structure it as follows:

1. **Plain-English Summary (5 lines or less):** State what is already protected today, what breaks if signatures grow, and the highest-priority exposure found.
2. **Mosca's Wave Classification:** List **Wave 1 (Urgent)**, **Wave 2 (Near-Term)**, and **Wave 3 (Scheduled)** systems based on confidentiality lifetime and upgrade difficulty.
3. **Five-Domain Exposure Table:** `Domain | Status (PASS / PARTIAL / EXPOSED / NOT CHECKED) | Observed Evidence | Plain-English Action`.
4. **Protocol & Code Blockers Found:** Exact file paths, reverse-proxy buffers, cookie sizes, DB columns, or unsupported runtimes observed.
5. **Verified vs. Unverified Scope:** Explicitly list what was directly inspected vs. what remains unverified (e.g., private HSM firmware, upstream CDN-origin links, third-party SaaS CBOMs).
