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:
- 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).
- Tier 2 β Deep Audit under Cryptographic Legal Mandate (Criminal Law Compliance): Unlocked exclusively after mathematical proof of domain ownership (via DNS
TXTrecord or/.well-known/aegis-verify.txt) and a signed audit mandate sealed with aSHA-256hash.
ποΈ 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_elementsvia 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=spf1record on the target domain, then falls back to wildcard records (*.parent) across parent domains viagetParentDomains. - 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 ofStrict-Transport-Security(HSTS),Content-Security-Policy(CSP),X-Frame-Options,X-Content-Type-Options,Referrer-Policy, andPermissions-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_PATCHvia Aegis Ingress PEP orHOST_PATCH_REQUIRED), - a step-by-step root fix procedure (
root_fix_procedure), - and a verification command (
verification_probe).
- a hot-mitigation coverage status (
π 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 β βββββββββββββββββββββββββββββββββββββββββββββββββββΊβ- Preferential Group Negotiation:
InspectDomainPQCdials port443over TLS withtls.X25519MLKEM768(0x11ec) placed first inCurvePreferences. - Cryptographic State Inspection (
EvaluateTLSConnectionState):- Case 1 β FIPS 203 Capable Server (
0x11ec):post_quantum_ready: truestandard: "NIST FIPS 203 (X25519MLKEM768)"hndl_risk: "LOW"- Automatically appends
Cryptographie TLS Post-Quantique (NIST FIPS 203)to the domainβstech_stack.
- Case 2 β Pre-Standard IETF Draft Server (
0x6399):post_quantum_ready: truestandard: "IETF Draft (X25519Kyber768Draft00 β Migration FIPS 203 recommandΓ©e)"hndl_risk: "MODERATE"with migration snippets toX25519MLKEM768.
- Case 3 β Classical Elliptic Curve Fallback (
X25519,P-256,P-384):post_quantum_ready: falsestandard: "Classical ECDHE (Non-PQC)"hndl_risk: "HIGH"- Emits the
PQC-HNDL-EXPOSUREwarning along with copy-paste remediation snippets (remediation_snippets).
- Case 1 β FIPS 203 Capable Server (
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 - CurveP256Nginx (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:
cd apps/backendgo 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:
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+
openssl s_client -connect cloudflare.com:443 -groups X25519MLKEM768βοΈ Tier 2: Cryptographic Legal Mandate & Ownership Proof (ownership.go)
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:
- Challenge Request (
POST /api/v1/audit/request-verification): Generates a cryptographic 96-bit random token (aegis-site-verification=aegis_verify_<24_hex>). - Zero-Negative-Cache Multi-Channel Verification (
POST /api/v1/audit/verify-ownership):- Checks for the DNS
TXTrecord 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.
- Checks for the DNS
- Tamper-Evident Audit Proof (
contract_text_hash): The signed mandate, signer IP address, UTC RFC 3339 timestamp, and legal contract text are hashed withSHA-256and stored in thedomain_ownership_contractsPostgreSQL table before executingrunLevel2DeepChecks.
π Further Reading
- Ingress PEP Gateway (WAF, Pure BFF & Virtual Patching): How vulnerabilities detected by the passive scanner are hot-patched at the edge in under 1.5 ms.
- Attack Simulation & Live Testbench: Replay controlled attack scenarios against your staging environment.