Skip to content

Passive Scanner, Legal Mandate & Post-Quantum Probe (ML-KEM)

The diagnostic engine in Aegis (apps/backend/internal/scanner) is built from the ground up around Legal-by-Design Ethics. Unlike traditional offensive scanners that fire intrusive requests against third-party hosts without authorization, Aegis strictly separates its analysis into two execution tiers:

  1. Tier 1 β€” 100% Passive Diagnostic (No Prior Mandate Required): Inspects only public metadata returned during standard browsing (public HTML, HTTP headers, public DNS records, and a standard Post-Quantum TLS 1.3 handshake).
  2. Tier 2 β€” Deep Audit under Cryptographic Legal Mandate (Criminal Law Compliance): Unlocked exclusively after mathematical proof of domain ownership (via DNS TXT record or /.well-known/aegis-verify.txt) and a signed audit mandate sealed with a SHA-256 hash.

πŸ›οΈ 2-Tier Scanner Architecture Diagram

[ Audit Request: Target Domain ]
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TIER 1: 100% PASSIVE PROBE (NO PRIOR MANDATE REQUIRED) β”‚
β”‚ POST /api/v1/audit/passive-scan β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ 1. Light Crawl & EcoIndex β”‚ β”‚ 2. Hierarchical DNS Inspection β”‚ β”‚
β”‚ β”‚ β€’ Up to 4 public pages β”‚ β”‚ β€’ A / AAAA Resolution β”‚ β”‚
β”‚ β”‚ β€’ DOM / Req / KB Quantiles β”‚ β”‚ β€’ Direct & Wildcard SPF (RFC 7208) β”‚ β”‚
β”‚ β”‚ β€’ 0-100 Score (A-G), gCO2e, β”‚ β”‚ β€’ Direct & Parent DMARC (RFC 7489) β”‚ β”‚
β”‚ β”‚ and Water footprint (cL) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ 3. HTTP Headers & CVE Matrix β”‚ β”‚ 4. Post-Quantum Readiness (PQC) β”‚ β”‚
β”‚ β”‚ β€’ HSTS, CSP, XFO, XCTO... β”‚ β”‚ β€’ TLS 1.3 Handshake (Go 1.25) β”‚ β”‚
β”‚ β”‚ β€’ Passive Fingerprinting β”‚ β”‚ β€’ Hybrid group X25519MLKEM768 β”‚ β”‚
β”‚ β”‚ β€’ Virtual Patching Coverage β”‚ β”‚ β€’ HNDL Risk & Config Snippets β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
Domain owner wishing β”‚ to unlock deep exposure probes
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ LEGAL SAFEGUARD: OWNERSHIP PROOF & SHA-256 SIGNED MANDATE β”‚
β”‚ POST /api/v1/audit/request-verification -> /api/v1/audit/verify-ownershipβ”‚
β”‚ β”‚
β”‚ 1. Unique token: aegis-site-verification=aegis_verify_<24_hex_chars> β”‚
β”‚ 2. DNS TXT check (@ or _aegis-challenge + 1.1.1.1 / 8.8.8.8 UDP fallback) β”‚
β”‚ or HTTPS file https://<domain>/.well-known/aegis-verify.txt β”‚
β”‚ 3. SHA-256 Seal: Hash(domain | email | signer_ip | timestamp | contract) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό (If and only if verified)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TIER 2: AUTHORIZED DEEP EXPOSURE PROBES (LEVEL 2) β”‚
β”‚ β”‚
β”‚ β€’ Secret exposure checks: /.env, /.git/config, /phpinfo.php β”‚
β”‚ β€’ CMS attack surface checks: /wp-login.php, /xmlrpc.php β”‚
β”‚ β€’ Verdict: PROTECTED (Filtered) / BLOCKED AT EDGE (HTTP 403) / EXPOSED (200)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” Deep Dive into the 4 Passive Scanner Modules (Tier 1)

When POST /api/v1/audit/passive-scan is called, the Go orchestrator (RunRealPassiveAudit in apps/backend/internal/scanner/engine.go) runs four non-intrusive modules in parallel:

1. RGESN Eco-Design Audit & EcoIndex Calculation (eco.go)

The scanner inspects the home page and up to 3 public internal pages (<a href> on the same domain) with a strict 3.5-second timeout:

  • Extracted Metrics: Transfer weight in KB (weight_kb), HTML tree complexity (dom_elements via tag count), and external sub-requests triggered (http_requests: scripts, stylesheets, images, iframes).
  • Official EcoIndex Formula (GreenIT Collective): Linear interpolation across the 20 official quantile tables (quantilesDOM, quantilesReq, quantilesSize): $$\text{EcoScore} = 100 - \frac{5 \times (3 \cdot Q_{\text{DOM}} + 2 \cdot Q_{\text{Req}} + Q_{\text{Size}})}{6}$$
  • Physical Footprint per Visit:
    • Greenhouse Gas Emissions ($\text{gCO}_2\text{e}$): $2 + \frac{2 \times (50 - \text{EcoScore})}{100}$
    • Water Consumption ($\text{cL}$): $3 + \frac{3 \times (50 - \text{EcoScore})}{100}$

2. Passive DNS Inspection & Hierarchical Traversal (dns.go)

InspectDomainDNS resolves IPv4/IPv6 addresses (A / AAAA) and checks email anti-spoofing records with full subdomain inheritance support:

  • SPF (RFC 7208): Looks up a direct v=spf1 record on the target domain, then falls back to wildcard records (*.parent) across parent domains via getParentDomains.
  • DMARC (RFC 7489 Section 6.6.3): Looks up _dmarc.<domain>. If a subdomain has no explicit DMARC record, the scanner traverses up to the organizational parent domain (_dmarc.<parent>) and validates inheritance provided subdomain policy is not explicitly disabled (sp=none).

3. Security Headers, Tech Fingerprinting & CVE Coverage Matrix (headers.go & fingerprint.go)

  • Security Headers (AnalyzeSecurityHeaders): Audits the presence and policy strength of Strict-Transport-Security (HSTS), Content-Security-Policy (CSP), X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and Permissions-Policy.
  • Passive Fingerprinting & CVE Matrix (DetectTechAndCVEs): Identifies technologies disclosed in HTTP headers (Server, X-Powered-By) and HTML markup, mapping each relevant CVE to:
    • a hot-mitigation coverage status (COVERED_VIRTUAL_PATCH via Aegis Ingress PEP or HOST_PATCH_REQUIRED),
    • a step-by-step root fix procedure (root_fix_procedure),
    • and a verification command (verification_probe).

πŸ” Focus: Post-Quantum Readiness Passive Probe (pqc.go)

Why Audit Post-Quantum Readiness Today?

Even though fault-tolerant cryptanalytic quantum computers (capable of running Shor’s algorithm to break RSA and classical elliptic curves like X25519 / P-256) are projected for the 2030+ timeframe, the HNDL (Harvest Now, Decrypt Later) threat is active right now: adversaries are recording encrypted TLS traffic today so they can decrypt sensitive payloads retroactively once quantum hardware matures.

To neutralize this threat, NIST standardized FIPS 203 (ML-KEM, derived from CRYSTALS-Kyber) in August 2024. In TLS 1.3, it is deployed via the hybrid key exchange group X25519MLKEM768 (0x11ec), natively supported in Go 1.25+, Cloudflare, OpenSSL 3.5+, BoringSSL, and modern browsers.

How the InspectDomainPQC Passive Handshake Works

Aegis Passive Scanner (Go 1.25) Target Server (:443)
─────────────────────────────── ────────────────────
β”‚ β”‚
β”‚ 1. TLS 1.3 ClientHello (3s Timeout) β”‚
β”‚ Supported Groups (CurvePreferences): β”‚
β”‚ [1] X25519MLKEM768 (0x11ec - NIST FIPS 203) β”‚
β”‚ [2] X25519Kyber768Draft00 (0x6399 - Draft) β”‚
β”‚ [3] X25519 (0x001d - Classical) β”‚
β”‚ [4] P-256 (0x0017) / P-384 (0x0018) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚
β”‚ β”‚
β”‚ 2. TLS 1.3 ServerHello β”‚
β”‚ KeyShare selected by the remote server β”‚
│◄──────────────────────────────────────────────────
β”‚ β”‚
β”‚ 3. Inspect conn.ConnectionState().CurveID β”‚
β”‚ β€’ If 0x11ec -> PostQuantumReady = true β”‚
β”‚ β€’ Otherwise -> Emit PQC-HNDL-EXPOSURE warning β”‚
β”‚ + Traefik/Nginx/Caddy snippets β”‚
β”‚ β”‚
β”‚ 4. Immediate clean closure of the TLS socket β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚
  1. Preferential Group Negotiation: InspectDomainPQC dials port 443 over TLS with tls.X25519MLKEM768 (0x11ec) placed first in CurvePreferences.
  2. Cryptographic State Inspection (EvaluateTLSConnectionState):
    • Case 1 β€” FIPS 203 Capable Server (0x11ec):
      • post_quantum_ready: true
      • standard: "NIST FIPS 203 (X25519MLKEM768)"
      • hndl_risk: "LOW"
      • Automatically appends Cryptographie TLS Post-Quantique (NIST FIPS 203) to the domain’s tech_stack.
    • Case 2 β€” Pre-Standard IETF Draft Server (0x6399):
      • post_quantum_ready: true
      • standard: "IETF Draft (X25519Kyber768Draft00 β€” Migration FIPS 203 recommandΓ©e)"
      • hndl_risk: "MODERATE" with migration snippets to X25519MLKEM768.
    • Case 3 β€” Classical Elliptic Curve Fallback (X25519, P-256, P-384):
      • post_quantum_ready: false
      • standard: "Classical ECDHE (Non-PQC)"
      • hndl_risk: "HIGH"
      • Emits the PQC-HNDL-EXPOSURE warning along with copy-paste remediation snippets (remediation_snippets).

Copy-Paste Post-Quantum Remediation Snippets Provided by Aegis

When post_quantum_ready is false, the API returns ready-to-use configuration snippets to enable X25519MLKEM768:

Traefik (v3.3+ / Dokploy)

tls:
options:
default:
minVersion: VersionTLS13
curvePreferences:
- X25519MLKEM768
- X25519
- CurveP256

Nginx (with OpenSSL 3.5+)

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

Caddy

tls {
protocols tls1.3
curves x25519mlkem768 x25519 secp256r1
}

Native Go Server (Go 1.25+)

tlsConfig := &tls.Config{
MinVersion: tls.VersionTLS13,
CurvePreferences: []tls.CurveID{tls.X25519MLKEM768, tls.X25519, tls.CurveP256},
}

πŸ§ͺ How to Test the Passive Scanner & PQC Probe

1. Run Unit Tests & Live Local TLS 1.3 Post-Quantum Handshake

apps/backend/internal/scanner/pqc_test.go includes an end-to-end test (TestLiveTLS13Handshake_NegotiatesX25519MLKEM768) that spins up a local TLS 1.3 server and verifies real negotiation of hybrid group 0x11ec:

Terminal window
cd apps/backend
go test -v ./internal/scanner -run "TestEvaluateTLSConnectionState|TestLiveTLS13Handshake"

2. Query the Passive Scanner API (/api/v1/audit/passive-scan)

When the Go Control Plane is running:

Terminal window
curl -s -X POST http://localhost:8080/api/v1/audit/passive-scan \
-H "Content-Type: application/json" \
-d '{"domain": "cloudflare.com"}' | jq '.post_quantum'

Example JSON output on a domain supporting X25519MLKEM768:

{
"post_quantum_ready": true,
"tls_version": "TLS 1.3",
"cipher_suite": "TLS_AES_128_GCM_SHA256",
"negotiated_curve": "X25519MLKEM768 (0x11ec)",
"standard": "NIST FIPS 203 (X25519MLKEM768)",
"hndl_risk": "LOW β€” ProtΓ©gΓ© contre les attaques Harvest Now, Decrypt Later (HNDL) via encapsulation hybride X25519 + ML-KEM-768."
}

3. Manual Verification with OpenSSL 3.5+

Terminal window
openssl s_client -connect cloudflare.com:443 -groups X25519MLKEM768

In strict compliance with Article 323-1 of the French Penal Code (and international equivalents such as the CFAA), any probe that checks for unlinked sensitive files (/.env, /.git/config, /phpinfo.php, /wp-login.php, /xmlrpc.php) requires explicit authorization from the verified domain owner:

  1. Challenge Request (POST /api/v1/audit/request-verification): Generates a cryptographic 96-bit random token (aegis-site-verification=aegis_verify_<24_hex>).
  2. Zero-Negative-Cache Multi-Channel Verification (POST /api/v1/audit/verify-ownership):
    • Checks for the DNS TXT record on @ or _aegis-challenge.<domain> using the system resolver, then directly queries Cloudflare (1.1.1.1:53) and Google (8.8.8.8:53) over UDP to bypass negative DNS caching delays.
    • Alternatively, checks for the token inside https://<domain>/.well-known/aegis-verify.txt.
  3. Tamper-Evident Audit Proof (contract_text_hash): The signed mandate, signer IP address, UTC RFC 3339 timestamp, and legal contract text are hashed with SHA-256 and stored in the domain_ownership_contracts PostgreSQL table before executing runLevel2DeepChecks.

πŸ“š Further Reading