@blamejs/exceptd-skills 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/AGENTS.md +232 -0
  2. package/ARCHITECTURE.md +267 -0
  3. package/CHANGELOG.md +616 -0
  4. package/CONTEXT.md +203 -0
  5. package/LICENSE +200 -0
  6. package/NOTICE +82 -0
  7. package/README.md +307 -0
  8. package/SECURITY.md +73 -0
  9. package/agents/README.md +81 -0
  10. package/agents/report-generator.md +156 -0
  11. package/agents/skill-updater.md +102 -0
  12. package/agents/source-validator.md +119 -0
  13. package/agents/threat-researcher.md +149 -0
  14. package/bin/exceptd.js +183 -0
  15. package/data/_indexes/_meta.json +88 -0
  16. package/data/_indexes/activity-feed.json +362 -0
  17. package/data/_indexes/catalog-summaries.json +229 -0
  18. package/data/_indexes/chains.json +7135 -0
  19. package/data/_indexes/currency.json +359 -0
  20. package/data/_indexes/did-ladders.json +451 -0
  21. package/data/_indexes/frequency.json +2072 -0
  22. package/data/_indexes/handoff-dag.json +476 -0
  23. package/data/_indexes/jurisdiction-clocks.json +967 -0
  24. package/data/_indexes/jurisdiction-map.json +536 -0
  25. package/data/_indexes/recipes.json +319 -0
  26. package/data/_indexes/section-offsets.json +3656 -0
  27. package/data/_indexes/stale-content.json +14 -0
  28. package/data/_indexes/summary-cards.json +1736 -0
  29. package/data/_indexes/theater-fingerprints.json +381 -0
  30. package/data/_indexes/token-budget.json +2137 -0
  31. package/data/_indexes/trigger-table.json +1374 -0
  32. package/data/_indexes/xref.json +818 -0
  33. package/data/atlas-ttps.json +282 -0
  34. package/data/cve-catalog.json +496 -0
  35. package/data/cwe-catalog.json +1017 -0
  36. package/data/d3fend-catalog.json +738 -0
  37. package/data/dlp-controls.json +1039 -0
  38. package/data/exploit-availability.json +67 -0
  39. package/data/framework-control-gaps.json +1255 -0
  40. package/data/global-frameworks.json +2913 -0
  41. package/data/rfc-references.json +324 -0
  42. package/data/zeroday-lessons.json +377 -0
  43. package/keys/public.pem +3 -0
  44. package/lib/framework-gap.js +328 -0
  45. package/lib/job-queue.js +195 -0
  46. package/lib/lint-skills.js +536 -0
  47. package/lib/prefetch.js +372 -0
  48. package/lib/refresh-external.js +713 -0
  49. package/lib/schemas/cve-catalog.schema.json +151 -0
  50. package/lib/schemas/manifest.schema.json +106 -0
  51. package/lib/schemas/skill-frontmatter.schema.json +113 -0
  52. package/lib/scoring.js +149 -0
  53. package/lib/sign.js +197 -0
  54. package/lib/ttp-mapper.js +80 -0
  55. package/lib/validate-catalog-meta.js +198 -0
  56. package/lib/validate-cve-catalog.js +213 -0
  57. package/lib/validate-indexes.js +83 -0
  58. package/lib/validate-package.js +162 -0
  59. package/lib/validate-vendor.js +85 -0
  60. package/lib/verify.js +216 -0
  61. package/lib/worker-pool.js +84 -0
  62. package/manifest-snapshot.json +1833 -0
  63. package/manifest.json +2108 -0
  64. package/orchestrator/README.md +124 -0
  65. package/orchestrator/dispatcher.js +140 -0
  66. package/orchestrator/event-bus.js +146 -0
  67. package/orchestrator/index.js +874 -0
  68. package/orchestrator/pipeline.js +201 -0
  69. package/orchestrator/scanner.js +327 -0
  70. package/orchestrator/scheduler.js +137 -0
  71. package/package.json +113 -0
  72. package/sbom.cdx.json +158 -0
  73. package/scripts/audit-cross-skill.js +261 -0
  74. package/scripts/audit-perf.js +160 -0
  75. package/scripts/bootstrap.js +205 -0
  76. package/scripts/build-indexes.js +721 -0
  77. package/scripts/builders/activity-feed.js +79 -0
  78. package/scripts/builders/catalog-summaries.js +67 -0
  79. package/scripts/builders/currency.js +109 -0
  80. package/scripts/builders/cwe-chains.js +105 -0
  81. package/scripts/builders/did-ladders.js +149 -0
  82. package/scripts/builders/frequency.js +89 -0
  83. package/scripts/builders/jurisdiction-clocks.js +126 -0
  84. package/scripts/builders/recipes.js +159 -0
  85. package/scripts/builders/section-offsets.js +162 -0
  86. package/scripts/builders/stale-content.js +171 -0
  87. package/scripts/builders/summary-cards.js +166 -0
  88. package/scripts/builders/theater-fingerprints.js +198 -0
  89. package/scripts/builders/token-budget.js +96 -0
  90. package/scripts/check-manifest-snapshot.js +217 -0
  91. package/scripts/predeploy.js +267 -0
  92. package/scripts/refresh-manifest-snapshot.js +57 -0
  93. package/scripts/refresh-sbom.js +222 -0
  94. package/skills/age-gates-child-safety/skill.md +456 -0
  95. package/skills/ai-attack-surface/skill.md +282 -0
  96. package/skills/ai-c2-detection/skill.md +440 -0
  97. package/skills/ai-risk-management/skill.md +311 -0
  98. package/skills/api-security/skill.md +287 -0
  99. package/skills/attack-surface-pentest/skill.md +381 -0
  100. package/skills/cloud-security/skill.md +384 -0
  101. package/skills/compliance-theater/skill.md +365 -0
  102. package/skills/container-runtime-security/skill.md +379 -0
  103. package/skills/coordinated-vuln-disclosure/skill.md +473 -0
  104. package/skills/defensive-countermeasure-mapping/skill.md +300 -0
  105. package/skills/dlp-gap-analysis/skill.md +337 -0
  106. package/skills/email-security-anti-phishing/skill.md +206 -0
  107. package/skills/exploit-scoring/skill.md +331 -0
  108. package/skills/framework-gap-analysis/skill.md +374 -0
  109. package/skills/fuzz-testing-strategy/skill.md +313 -0
  110. package/skills/global-grc/skill.md +564 -0
  111. package/skills/identity-assurance/skill.md +272 -0
  112. package/skills/incident-response-playbook/skill.md +546 -0
  113. package/skills/kernel-lpe-triage/skill.md +303 -0
  114. package/skills/mcp-agent-trust/skill.md +326 -0
  115. package/skills/mlops-security/skill.md +325 -0
  116. package/skills/ot-ics-security/skill.md +340 -0
  117. package/skills/policy-exception-gen/skill.md +437 -0
  118. package/skills/pqc-first/skill.md +546 -0
  119. package/skills/rag-pipeline-security/skill.md +294 -0
  120. package/skills/researcher/skill.md +310 -0
  121. package/skills/sector-energy/skill.md +409 -0
  122. package/skills/sector-federal-government/skill.md +302 -0
  123. package/skills/sector-financial/skill.md +398 -0
  124. package/skills/sector-healthcare/skill.md +373 -0
  125. package/skills/security-maturity-tiers/skill.md +464 -0
  126. package/skills/skill-update-loop/skill.md +463 -0
  127. package/skills/supply-chain-integrity/skill.md +318 -0
  128. package/skills/threat-model-currency/skill.md +404 -0
  129. package/skills/threat-modeling-methodology/skill.md +312 -0
  130. package/skills/webapp-security/skill.md +281 -0
  131. package/skills/zeroday-gap-learn/skill.md +350 -0
  132. package/vendor/blamejs/LICENSE +201 -0
  133. package/vendor/blamejs/README.md +54 -0
  134. package/vendor/blamejs/_PROVENANCE.json +54 -0
  135. package/vendor/blamejs/retry.js +335 -0
  136. package/vendor/blamejs/worker-pool.js +418 -0
@@ -0,0 +1,300 @@
1
+ ---
2
+ name: defensive-countermeasure-mapping
3
+ version: "1.0.0"
4
+ description: Map offensive findings (CVE / TTP / framework gap) to MITRE D3FEND defensive countermeasures with explicit defense-in-depth, least-privilege, and zero-trust layering
5
+ triggers:
6
+ - defensive mapping
7
+ - d3fend
8
+ - countermeasure
9
+ - blue team
10
+ - defense in depth
11
+ - least privilege
12
+ - zero trust
13
+ - control mapping
14
+ - mitigation
15
+ - defensive coverage
16
+ - blue team map
17
+ data_deps:
18
+ - d3fend-catalog.json
19
+ - atlas-ttps.json
20
+ - cve-catalog.json
21
+ - framework-control-gaps.json
22
+ - cwe-catalog.json
23
+ - dlp-controls.json
24
+ atlas_refs: []
25
+ attack_refs: []
26
+ framework_gaps: []
27
+ rfc_refs: []
28
+ cwe_refs: []
29
+ d3fend_refs:
30
+ - D3-ASLR
31
+ - D3-CA
32
+ - D3-CBAN
33
+ - D3-CSPP
34
+ - D3-DA
35
+ - D3-EAL
36
+ - D3-EHB
37
+ - D3-FAPA
38
+ - D3-FE
39
+ - D3-IOPR
40
+ - D3-MENCR
41
+ - D3-MFA
42
+ - D3-NI
43
+ - D3-NTA
44
+ - D3-NTPM
45
+ - D3-PA
46
+ - D3-PHRA
47
+ - D3-PSEP
48
+ - D3-RPA
49
+ - D3-SCP
50
+ last_threat_review: "2026-05-11"
51
+ ---
52
+
53
+ # Defensive Countermeasure Mapping — D3FEND as the Blue-Team Counterpart to ATT&CK / ATLAS
54
+
55
+ ATT&CK and ATLAS catalog what attackers do. D3FEND catalogs what defenders do, in the same technique-grain taxonomy. Most SOCs in mid-2026 maintain an ATT&CK heatmap of detection coverage; far fewer maintain a D3FEND coverage map of the controls that actually counter those techniques. Operators can articulate attacker behavior with technique-level precision but can only articulate their own defenses at framework-control granularity ("we have SI-2"), which is a category mismatch. This skill closes that mismatch. Inputs are offensive findings — a CVE, an ATT&CK or ATLAS technique, a framework control gap. Outputs are layered defensive-countermeasure maps grounded in `data/d3fend-catalog.json` and explicitly threaded through defense-in-depth, least-privilege, and zero-trust principles.
56
+
57
+ ---
58
+
59
+ ## Threat Context (mid-2026)
60
+
61
+ ATT&CK and ATLAS are now load-bearing in SOC detection engineering. Detection content is written against technique IDs; red-team reports are mapped to technique IDs; threat intel feeds emit technique IDs. The result: the offensive side of every blue-team discussion is technique-grained and crisp.
62
+
63
+ The defensive side has not caught up. Most SOCs maintain an ATT&CK heatmap (coverage of detection rules by technique). Few maintain a D3FEND coverage map of the controls that actually counter those techniques. The structural failure has three observable shapes:
64
+
65
+ - **Detect-only blue teams.** A SOC will claim coverage of T1068 (Privilege Escalation) because EDR alerts fire on suspicious process behavior. The Harden, Isolate, Evict, and Restore tactics are unrepresented. For Copy Fail (CVE-2026-31431) that means the org has a detection rule for the post-exploit shell but no D3-SCP (seccomp), no D3-PHRA (hardware isolation), and no live-patch path under D3-PA. Defense is one-layer-deep; the attacker only has to bypass detection to win.
66
+ - **Framework-grained articulation.** Asked "what countermeasures are in place for prompt injection?", the team answers "we have AC-3 and SI-10." Both controls exist on paper. Neither describes a defensive technique at the grain the attack operates at. The actual D3FEND mappings (D3-IOPR for I/O profiling, D3-CSPP for client-server payload profiling, D3-EAL for tool allowlisting on the MCP server side) are absent from the team's vocabulary.
67
+ - **Implicit-trust controls treated as zero-trust.** Many deployed defenses verify identity once at the perimeter and trust thereafter. Under D3FEND grain, these are not zero-trust controls — D3-NI (Network Isolation) without D3-NTA (Network Traffic Analysis) and per-request authorization assumes implicit trust on segments. The compliance audit passes; an attacker with one foothold moves laterally without re-verification.
68
+
69
+ Concrete examples from this project's catalogs:
70
+
71
+ - **Copy Fail (CVE-2026-31431).** Offensive: T1068 + AML.T0017. Defensive map produced by this skill: D3-EAL (Harden), D3-EHB (Harden), D3-SCP (Isolate), D3-PHRA (Isolate), D3-PA (Detect), plus the live-patch path under `kernel-lpe-triage`. A SOC claiming "we have EDR" is at one D3FEND layer for a five-layer-deep finding.
72
+ - **Windsurf MCP RCE (CVE-2026-30615).** Offensive: AML.T0010 + AML.T0096 + T1195.001. Defensive map: D3-EHB (binary hash pinning, primary), D3-EAL (executable allowlist on the MCP runtime), D3-NTA (network traffic analysis on egress from the dev workstation), D3-CSPP (payload profiling on MCP JSON-RPC calls), D3-IOPR (I/O profiling of tool invocations). Five D3FEND IDs spanning Harden / Isolate / Detect — the depth most "we trust our IDE plugins" defenses lack.
73
+ - **SesameOp AI-as-C2 campaign.** Offensive: AML.T0096 + T1071 + T1102. Defensive map: D3-NTA + D3-CSPP on Azure OpenAI egress, D3-DA (Domain Analysis) for the C2 domain set, D3-NTPM (Network Traffic Policy Mapping) to model legitimate-versus-anomalous LLM API usage, D3-RPA (Remote Process Analysis) on the calling host. The Detect tactic dominates here because Harden does not apply to a covert channel riding legitimate API traffic — which is itself a finding worth surfacing.
74
+
75
+ The skill exists because the inverse direction — given a CVE or TTP, produce the layered countermeasure map — is the question SOCs need to answer to demonstrate operational defense, and it is the question framework controls cannot answer at the right grain.
76
+
77
+ ---
78
+
79
+ ## Framework Lag Declaration
80
+
81
+ No major compliance framework requires technique-grained defensive mapping. Each requires controls; none require controls expressed in the D3FEND technique taxonomy that mirrors ATT&CK and ATLAS. The MITRE ATT&CK Mappings v17 project (the NIST 800-53 → ATT&CK and D3FEND → NIST 800-53 crosswalks) provides the bridge, but operator awareness is limited and no framework yet requires its use.
82
+
83
+ | Jurisdiction | Framework / Control | What It Requires | Why It Is Insufficient at D3FEND Grain |
84
+ |---|---|---|---|
85
+ | US | NIST CSF 2.0 PROTECT (PR.AA, PR.DS, PR.PS, PR.IR, PR.PE) | Identity management, data security, platform security, infrastructure resilience, environmental protection | High-level outcomes. Does not require mapping each protect outcome to a D3FEND technique. A PR.PS implementation can be a vendor product purchase with no per-technique verification. |
86
+ | US | NIST 800-53 Rev 5 | Per-control families (AC, AU, CM, CP, IR, SI, SC, etc.) | Framework controls, not defensive techniques. "Implement SI-3 malicious code protection" is satisfied by deploying AV; it does not require D3-PA (Process Analysis) or D3-FAPA (File Access Pattern Analysis) at the technique grain. |
87
+ | US | NIST AI RMF 1.0 MAP / MEASURE / MANAGE | AI risk management functions | Risk-management vocabulary. No technique-level defensive mapping for AML attack surface. AI-pipeline gaps go invisible at this grain. |
88
+ | EU | NIS2 Directive Art. 21 | "Appropriate and proportionate technical, operational and organisational measures" | Outcome language. Member-state transpositions vary. None require D3FEND mapping or technique-grained defensive coverage demonstration. |
89
+ | EU | DORA Art. 6–10 | ICT risk management for financial entities | Risk-management process. Defensive technique grain unspecified. |
90
+ | EU | EU AI Act Art. 15 | "Appropriate level of accuracy, robustness and cybersecurity" for high-risk systems | Outcome standard. No technique mapping for AML or LLM attack surface. |
91
+ | EU | EU CRA | Cybersecurity essential requirements for products with digital elements | Product-level requirements. Says nothing about how an operator should structure defensive coverage. |
92
+ | UK | NCSC CAF v3.2 Objective B (Protecting against cyber attack) | Outcome-based principles (B1–B6) | Outcome-based by design. CAF does not prescribe defensive techniques. A B2 (identity and access control) achievement can be a SSO deployment with no D3-MFA / D3-CBAN technique verification. |
93
+ | UK | Cyber Essentials Plus | Five technical control categories | Coarse-grained checklist. No technique-level mapping. |
94
+ | AU | ASD Essential 8 ML1–ML3 | Eight mitigation strategies (app control, patching, MFA, etc.) | Closest to technique-grain (Essential 8 has named strategies) but still control-level not technique-level. Application Control is roughly D3-EAL / D3-EHB but the maturity model does not distinguish path-based allowlist from cryptographic hash allowlist. |
95
+ | AU | ISM | Detailed control catalog | Control-level. Does not require D3FEND mapping. |
96
+ | AU | APRA CPS 234 | Information security capability for regulated entities | Capability-level. Defensive technique grain unspecified. |
97
+ | Global | ISO 27001:2022 Annex A | 93 controls across organisational / people / physical / technological | Control-level. ISO 27001:2022 added A.5.7 (Threat Intelligence) and A.8.16 (Monitoring activities) but neither requires defensive technique mapping. |
98
+ | Global | ISO 27002:2022 | Implementation guidance for Annex A | Guidance, not requirement. |
99
+ | Industry | PCI DSS v4.0 | Twelve requirements for cardholder data environments | Control-level. The closest technique-grain language is in 5.x (malware protection) — does not require D3FEND mapping. |
100
+ | Industry | SOC 2 TSC | Trust Services Criteria outcome categories | Outcome-level. Auditor discretion on implementation. |
101
+
102
+ The cross-framework pattern is uniform: every framework operates at control or outcome grain. D3FEND operates at technique grain. The translation layer — which technique counters which attack technique, in which D3FEND tactic, at which trust posture, at which privilege scope — is the gap this skill fills. The framework controls themselves are not wrong; they are coarser than the threat. Per AGENTS.md hard rule #2, the framework lag is structural: no framework yet operationalizes the defensive technique taxonomy.
103
+
104
+ ---
105
+
106
+ ## TTP Mapping
107
+
108
+ This is a meta-mapping skill. Its TTP coverage equals the union of: every ATLAS technique in `data/atlas-ttps.json`, every ATT&CK technique appearing in any `attack_refs` field across the skill library, and every offensive technique referenced in any `counters_attack_techniques` array inside `data/d3fend-catalog.json`. Per AGENTS.md hard rule #4, every D3FEND ID in the catalog is mapped to at least one offensive technique — there are no orphan defensive entries.
109
+
110
+ The skill consumes offensive findings from these inputs and produces defensive mappings. It does not author new offensive technique entries; that is the job of the catalogs upstream and the `zeroday-gap-learn` and `threat-model-currency` skills. The cross-walk surfaces:
111
+
112
+ | Input Source | Read From | Skill Produces |
113
+ |---|---|---|
114
+ | CVE | `data/cve-catalog.json` (entry's `atlas_refs`, `attack_refs`, `cwe_refs`) | D3FEND IDs whose `counters_attack_techniques` includes those refs |
115
+ | ATLAS technique | `data/atlas-ttps.json` | D3FEND IDs whose `counters_attack_techniques` lists the ATLAS ID |
116
+ | ATT&CK technique | implicit (no local ATT&CK catalog; technique is the key) | D3FEND IDs whose `counters_attack_techniques` includes the T-number |
117
+ | Framework gap | `data/framework-control-gaps.json` | D3FEND IDs whose `framework_controls_partially_mapped` references the gapped control |
118
+ | CWE | `data/cwe-catalog.json` | D3FEND IDs that mitigate the CWE's root-cause class (joined via the CVE catalog) |
119
+ | Data-loss / exfil concern | `data/dlp-controls.json` | D3FEND IDs in the Isolate and Detect tactics that the DLP entry's `d3fend_refs` field points to |
120
+
121
+ Reference `data/atlas-ttps.json` and `data/d3fend-catalog.json` for the canonical cross-references. The skill never invents a mapping not present in the catalogs; if a finding has no D3FEND coverage in the catalog, that is itself a finding to surface and route to `zeroday-gap-learn` for catalog update.
122
+
123
+ ---
124
+
125
+ ## Exploit Availability Matrix
126
+
127
+ This skill is the inverse of `exploit-scoring`. Where `exploit-scoring` produces a per-CVE matrix of offensive availability (CVSS, RWEP, KEV, PoC, AI-acceleration, live-patch availability), this skill consumes that matrix and produces the dual — a per-D3FEND-ID **defensive availability matrix** for the same finding. The dual question is not "how exploitable is this in the wild" but "how defended is this in the org's stack." Both matrices are per-finding; together they form the offense-defense pair the SOC needs.
128
+
129
+ For each D3FEND ID surfaced by Analysis Procedure Step 3, the matrix records:
130
+
131
+ | Factor | Source | Meaning |
132
+ |---|---|---|
133
+ | Deployed in the org's stack? | operator input, verified against asset inventory | Is the control actually running, or only purchased / specified? |
134
+ | Tunable per environment? | `data/d3fend-catalog.json` `implementation_examples` | Can the control be tuned for serverless vs. monolith vs. ephemeral container, or is it host-only? |
135
+ | AI-pipeline applicable? | `data/d3fend-catalog.json` `ai_pipeline_applicability` (mandatory per AGENTS.md rule #9) | Per rule #9, if the control is architecturally impossible in serverless / container / AI pipeline contexts, the catalog declares an explicit alternative (e.g., admission-controller signature verification as the D3-EAL surrogate for serverless). The matrix surfaces that alternative. |
136
+ | Defense-in-depth layer | computed from `data/d3fend-catalog.json` `tactic` (Model / Harden / Detect / Isolate / Deceive / Evict / Restore) | Which DiD layer the control occupies for this finding. A finding defended only in one layer is under-defended. |
137
+ | Privilege scope | computed from `data/d3fend-catalog.json` description and from the operator's deployment context | Per-process (D3-EAL, D3-EHB), per-segment (D3-NTA, D3-NI), per-request (D3-CBAN, D3-MFA when continuously verified), or blanket (D3-PSEP / D3-ASLR — kernel-wide). |
138
+ | Zero-trust posture | computed from D3FEND description; verifies-per-request vs. trusts-after-perimeter | A control that verifies on every request (D3-MFA continuous reauth, D3-CBAN per-call) is zero-trust. A control that authenticates once and trusts thereafter (vanilla session cookies, perimeter-only D3-NI) is implicit-trust. |
139
+ | Framework controls partially mapped | `data/d3fend-catalog.json` `framework_controls_partially_mapped` | The framework controls that nominally cover this technique but, per `lag_notes`, fail to operationalize it at D3FEND grain. |
140
+ | Live-tunable vs. requires deploy | operator input, joined with `implementation_examples` | Can the control be tuned without a rolling deploy (e.g., updating a Kyverno policy) or does it require image rebuilds and reboots? |
141
+
142
+ If the operator cannot supply deployment-status data, the matrix surfaces "unknown deployment status — must verify against asset inventory before claiming coverage" and the skill flags the finding as undefended for reporting purposes. Per AGENTS.md hard rule #10, no fabricated deployment data.
143
+
144
+ ---
145
+
146
+ ## Analysis Procedure
147
+
148
+ The procedure is threaded through three foundational principles. None are optional. Every output of this skill must visibly thread all three.
149
+
150
+ ### Foundational principle 1 — Defense in depth
151
+
152
+ For any offensive finding, surface **multiple D3FEND IDs across different D3FEND tactics**. A finding mapped to a single D3FEND ID is, by definition, an under-defended finding. The taxonomy lists seven tactics (Model, Harden, Detect, Isolate, Deceive, Evict, Restore). A complete defensive map should populate at least three of them, with the floor being **Harden + Detect + Isolate** for any RWEP-significant finding. Findings that admit only one tactic (e.g., AI-as-C2 over legitimate API channels admits Detect almost exclusively) must surface that asymmetry as its own observation — the inability to Harden is itself a finding.
153
+
154
+ ### Foundational principle 2 — Least privilege
155
+
156
+ Every D3FEND mapping must carry a **privilege-scoping note**. Controls differ sharply in scope:
157
+
158
+ - Per-process scope: D3-EAL (executable allowlisting), D3-EHB (executable hash-based allowlisting), D3-SCP (seccomp / syscall filtering), D3-PA (process analysis).
159
+ - Per-segment scope: D3-NTA (network traffic analysis), D3-NI (network isolation), D3-NTPM (network traffic policy mapping).
160
+ - Per-request scope: D3-CBAN (certificate-based authentication when verified per call), D3-MFA (multi-factor authentication when reauthenticated per session-action).
161
+ - Blanket scope (kernel-wide, applies to all processes uniformly): D3-PSEP (DEP/NX), D3-ASLR (KASLR), D3-PHRA (hardware resource access).
162
+
163
+ Least-privilege defense requires picking the finest available scope. A blanket-scope control is not a substitute for a per-process control when the threat operates at process grain. The output must surface, for each D3FEND ID, the scope at which it applies for this finding.
164
+
165
+ ### Foundational principle 3 — Zero trust
166
+
167
+ Every D3FEND mapping must carry a **trust-posture classification**:
168
+
169
+ - **Verifies on every request.** Examples: D3-CBAN with per-call certificate validation, D3-MFA with continuous reauth, D3-CSPP applied to every JSON-RPC call.
170
+ - **Verifies on session establishment, trusts thereafter.** Examples: vanilla TLS session resumption, perimeter D3-NI without internal traffic analysis.
171
+ - **Assumes implicit trust on a segment.** Examples: bare D3-NI without D3-NTA inside the segment.
172
+
173
+ Zero-trust-compliant defense maps to controls that verify per request. Implicit-trust controls are not invalid — they are layer-1 — but the output must label them so the operator can see the trust assumption a given control is making. Per AGENTS.md DR-1, never imply a framework control is adequate when current TTPs bypass it; the trust-posture column is the explicit corrective.
174
+
175
+ ### Steps
176
+
177
+ **Step 1 — Ingest the offensive finding.** Classify the input as one of: CVE, ATLAS technique, ATT&CK technique, framework gap, CWE, or DLP/exfil concern. If the input is a CVE, pull the full entry from `data/cve-catalog.json` and extract `atlas_refs`, `attack_refs`, and `cwe_refs`. If the input is a TTP, capture it directly. If a framework gap, pull the full gap entry from `data/framework-control-gaps.json` and capture the controls that nominally cover it. If a CWE, pull it from `data/cwe-catalog.json` and capture the linked CVE class. If a DLP concern, pull from `data/dlp-controls.json` and capture the linked D3FEND techniques directly. Output the classification at the top of the report — every downstream step depends on it.
178
+
179
+ **Step 2 — Build the offensive-technique set.** For the input, build the full set of offensive techniques to map against. For a CVE: union of `atlas_refs` and `attack_refs`. For a TTP: the TTP itself. For a CWE: every CVE in `data/cve-catalog.json` that references the CWE, then the union of their `atlas_refs` and `attack_refs`. For a framework gap: the threats the gap is documented against in `data/framework-control-gaps.json`. The output of this step is a concrete list of technique IDs the defensive map must counter.
180
+
181
+ **Step 3 — Query D3FEND.** For every technique ID from Step 2, scan `data/d3fend-catalog.json` for entries whose `counters_attack_techniques` array includes that ID. Capture every match — do not stop at the first. Group results by D3FEND tactic (Model / Harden / Detect / Isolate / Deceive / Evict / Restore). The tactic grouping is the defense-in-depth view.
182
+
183
+ **Step 4 — Score each candidate countermeasure.** For each D3FEND ID surfaced in Step 3, record:
184
+ (a) Deployment status. Operator answers: deployed / partially deployed / not deployed / unknown.
185
+ (b) AI-pipeline applicability per AGENTS.md rule #9. Read `ai_pipeline_applicability` directly from `data/d3fend-catalog.json`. If the catalog states the control is architecturally impossible in the operator's environment, capture the explicit alternative the catalog provides.
186
+ (c) Defense-in-depth layer position — the D3FEND tactic the technique belongs to.
187
+ (d) Least-privilege scope — per-process / per-segment / per-request / blanket, per the principle 2 classification.
188
+ (e) Zero-trust posture — verifies-per-request / verifies-on-session / implicit-trust-on-segment, per the principle 3 classification.
189
+ (f) Live-tunable vs. requires deploy. Pull from `implementation_examples` and operator deployment context.
190
+
191
+ **Step 5 — Compute defensive depth.** Count the number of distinct D3FEND tactics in the map for this finding. If fewer than three tactics are populated, flag the finding as under-defended at the depth dimension. Separately, for each tactic, count how many D3FEND IDs are deployed (per Step 4(a)). If any tactic is empty of deployed controls, flag that tactic as a depth gap.
192
+
193
+ **Step 6 — Compute compliance-theater overlap.** For every D3FEND ID surfaced, read `framework_controls_partially_mapped` and the matching `lag_notes` from `data/d3fend-catalog.json`. Output the framework controls the operator's audit will claim as coverage and the lag-note text describing why those controls are insufficient at D3FEND grain. This is the bridge into the compliance-theater check below.
194
+
195
+ **Step 7 — Cross-walk through CWE and DLP.** If the finding has a CWE in `data/cwe-catalog.json`, surface the CWE's root-cause mitigation chain and link to any D3FEND IDs the catalog maps to that chain. If the finding involves data exfiltration, surface the `data/dlp-controls.json` entries whose `d3fend_refs` overlap with the D3FEND IDs surfaced in Step 3. The dual catalog joins ensure no orphan defensive recommendation.
196
+
197
+ **Step 8 — Produce the defensive-coverage map.** Render the matrix per Output Format below. Surface gaps prominently. Route to `policy-exception-gen` for any D3FEND ID the operator declares architecturally impossible. Route to `framework-gap-analysis` for any `framework_controls_partially_mapped` entry the operator wants escalated. Route to `zeroday-gap-learn` if any offensive technique in Step 2 has zero D3FEND coverage in the catalog (the catalog itself is the gap, not just the operator's deployment).
198
+
199
+ ---
200
+
201
+ ## Output Format
202
+
203
+ ```
204
+ # Defensive Countermeasure Map — <input>
205
+
206
+ ## What this is
207
+ <one-line classification + canonical reference>
208
+ Example: "CVE — Linux kernel LPE. Canonical: CVE-2026-31431 (Copy Fail)."
209
+
210
+ ## Offensive technique set (input to D3FEND query)
211
+ - <AML.Txxxx / Txxxx / CWE-xxx list, with one-line descriptions>
212
+
213
+ ## Defensive-coverage map
214
+ | D3FEND ID | Name | Tactic (DiD layer) | Privilege scope | ZT posture | Deployed? | AI-pipeline applicable? | Framework controls partially mapped | Live-tunable? |
215
+ |-----------|------|--------------------|-----------------|------------|-----------|--------------------------|--------------------------------------|---------------|
216
+ | D3-EAL | Executable Allowlisting | Harden | per-process | verifies on exec | partial | partially (serverless surrogate: admission-controller signature verification per d3fend-catalog) | NIST-800-53-CM-7(1), ISO-27001-2022-A.8.19 | tunable via policy update |
217
+ | D3-EHB | Executable Hashbased Allowlist | Harden | per-process | verifies on exec | not deployed | yes (hash check at load time) | NIST-800-53-SA-12, SOC2-CC9.2 | tunable via hash list update |
218
+ | D3-SCP | System Call Filtering | Isolate | per-process | verifies on syscall | partial | yes (seccomp profile applies in container runtime) | NIST-800-53-SC-39 | tunable via profile update |
219
+ | D3-PA | Process Analysis | Detect | per-process | verifies on event | deployed | yes (EDR or eBPF) | NIST-800-53-SI-4 | tunable via rule update |
220
+ | ... | ... | ... | ... | ... | ... | ... | ... | ... |
221
+
222
+ ## Defense-in-depth summary
223
+ - Tactics populated: <count> of 7 (Model / Harden / Detect / Isolate / Deceive / Evict / Restore).
224
+ - Tactics with at least one deployed control: <count>.
225
+ - Under-defended tactics: <list — tactics with zero deployed controls>.
226
+ - Verdict: <defended at depth N | under-defended at depth N — needs M more tactics populated>.
227
+
228
+ ## Least-privilege summary
229
+ - Per-process controls: <list + deployment status>.
230
+ - Per-segment controls: <list + deployment status>.
231
+ - Per-request controls: <list + deployment status>.
232
+ - Blanket controls: <list — note these are baselines, not substitutes for finer-grained controls>.
233
+
234
+ ## Zero-trust summary
235
+ - Controls that verify per request: <list>.
236
+ - Controls that verify on session: <list>.
237
+ - Controls that assume implicit trust: <list — these are pre-zero-trust and must be paired with continuous verification or replaced>.
238
+
239
+ ## Compliance-theater overlap
240
+ For each D3FEND ID surfaced, the framework controls the audit will claim as coverage and the lag-note from data/d3fend-catalog.json describing the grain mismatch. Example: "CM-7(1) covers least functionality, but accepts inventory-only implementations; D3-EAL requires runtime blocking — claim is paper-compliant only."
241
+
242
+ ## Gaps and proposed remediation
243
+ 1. <Specific deployment gap, e.g. "Deploy D3-EHB hash-pinning for MCP server binaries — currently not deployed; closes Detect-only coverage of T1195.001">.
244
+ 2. <Specific scope gap, e.g. "D3-NI is deployed at perimeter; add D3-NTA on internal segments to convert implicit-trust to verifies-per-request">.
245
+ 3. <Specific catalog gap, e.g. "AML.T0xxx has no D3FEND coverage in catalog — route to zeroday-gap-learn to add a defensive entry">.
246
+
247
+ ## Global jurisdiction angle
248
+ EU: <which NIS2 / DORA / EU AI Act / EU CRA articles intersect the framework_controls_partially_mapped>.
249
+ UK: <NCSC CAF objective + Cyber Essentials Plus relevance>.
250
+ AU: <Essential 8 strategy + ISM control + APRA CPS 234 trigger if regulated>.
251
+ ISO 27001:2022: <Annex A control IDs from framework_controls_partially_mapped>.
252
+ US (for context): <NIST 800-53 control IDs + NIST CSF 2.0 function + NIST AI RMF function if AI-related>.
253
+
254
+ ## Routed to
255
+ Primary: <this skill produced the map; no further routing required unless a gap was surfaced>.
256
+ For deployment gaps: skills/security-maturity-tiers — sequence the missing D3FEND IDs across MVP / Practical / Overkill tiers.
257
+ For catalog gaps: skills/zeroday-gap-learn — add the missing D3FEND entry to data/d3fend-catalog.json.
258
+ For ephemeral/serverless exception scope: skills/policy-exception-gen — document the architectural alternative.
259
+ For framework-grain escalation: skills/framework-gap-analysis — escalate the lag-note evidence.
260
+ ```
261
+
262
+ The map fits on one or two pages depending on the number of D3FEND IDs surfaced. The "Defense-in-depth summary", "Least-privilege summary", and "Zero-trust summary" sections are mandatory — they are the explicit thread for the three foundational principles and must be visible in every report.
263
+
264
+ ---
265
+
266
+ ## Compliance Theater Check
267
+
268
+ The theater test for this skill is direct: the operator's defensive program is in theater if it can articulate attacker behavior at technique grain but cannot articulate its own defenses at the same grain.
269
+
270
+ > "For the top 10 ATT&CK techniques in your industry's threat intel for the last 90 days, list the D3FEND countermeasures deployed at each defense-in-depth layer (Harden, Detect, Isolate, Evict, Restore). For each D3FEND ID listed, state the privilege scope (per-process / per-segment / per-request / blanket) and the zero-trust posture (verifies-per-request / verifies-on-session / implicit-trust-on-segment). If the answer is 'we do not track at that level' or only one layer is named per technique, the defensive program is theater — the operator can describe attacks at technique grain but defends at framework-control grain, a category mismatch the audit cannot detect."
271
+
272
+ A second, complementary test:
273
+
274
+ > "Show your D3FEND coverage heatmap alongside your ATT&CK heatmap. If you have an ATT&CK heatmap (offensive coverage) but no D3FEND heatmap (defensive coverage at the same grain), your blue-team articulation is one-sided. The most common shape: ATT&CK heatmap exists, populated by EDR alerts; D3FEND heatmap does not exist; Harden, Isolate, Evict, and Restore tactics have no operator-known content. The org has bought defensive products and deployed framework controls, but cannot list which D3FEND technique each product implements. Per AGENTS.md DR-1, the framework controls are being treated as truth at a grain they do not address."
275
+
276
+ A third test, specific to AI-pipeline environments per AGENTS.md hard rule #9:
277
+
278
+ > "Pick any AI / LLM / RAG / MCP workload in your environment. List the D3FEND controls you would deploy on an on-prem monolith for the equivalent attack surface. Now, for each, state whether the control is architecturally possible in your ephemeral/serverless/AI pipeline runtime, and if not, what the explicit alternative is per `data/d3fend-catalog.json`'s `ai_pipeline_applicability` field. If the answer is 'the framework control exists, so we are covered', the program is in theater — the framework control is architecturally impossible in the workload's runtime and the alternative was never scoped. The audit passes; the workload is undefended."
279
+
280
+ An org that maintains a D3FEND coverage map alongside its ATT&CK heatmap, with explicit tactic-by-tactic deployment, scope and trust-posture annotations, and explicit ephemeral-environment alternatives, is not in theater. An org whose defensive articulation is "we have AC-3 and SI-4" without a technique-grain bridge to those controls is in theater for any RWEP-significant finding in its catalog — the program is paper-compliant, technique-blind.
281
+
282
+ ---
283
+
284
+ ## Defensive Countermeasure Mapping
285
+
286
+ This skill is itself the canonical mapper. The section name doubles as the section heading and as a recursive entry point: when another skill in the library needs to surface a defensive map for its finding, it routes here, and this skill produces the map by traversing the cross-walks enumerated below.
287
+
288
+ The cross-walks the skill maintains:
289
+
290
+ - **ATT&CK → D3FEND.** Sourced from the MITRE ATT&CK Mappings v17 NIST 800-53 → ATT&CK and D3FEND → ATT&CK crosswalks, materialized locally in `data/d3fend-catalog.json` as the `counters_attack_techniques` array on every D3FEND entry. To map an ATT&CK T-number to D3FEND, scan every catalog entry and collect those whose `counters_attack_techniques` includes the T-number. This skill never invents a mapping not present in the catalog; if a T-number has no coverage, the absence is a finding routed to `zeroday-gap-learn`.
291
+
292
+ - **ATLAS → D3FEND.** Sourced from cross-references in `data/atlas-ttps.json` (each ATLAS entry's defensive references) and from `data/d3fend-catalog.json` (each D3FEND entry's `counters_attack_techniques` array, which carries AML.T-numbers in addition to T-numbers). To map an AML.T technique to D3FEND, scan the catalog the same way as for ATT&CK. The bidirectional consistency is enforced by `lib/lint-skills.js` and by the schemas declared in the catalog `_meta` blocks.
293
+
294
+ - **CWE → D3FEND.** Sourced from root-cause mitigation chains in `data/cwe-catalog.json`. Each CWE entry links to one or more CVEs in `data/cve-catalog.json`; each CVE carries an `attack_refs` and `atlas_refs` array; the union of those refs is the technique set whose D3FEND coverage forms the CWE's defensive map. The chain is: CWE → CVE → ATT&CK/ATLAS → D3FEND. This skill walks the chain; the operator does not have to.
295
+
296
+ - **Framework controls → D3FEND.** Sourced from `framework_controls_partially_mapped` in `data/d3fend-catalog.json` and from `data/framework-control-gaps.json`. For a given framework control ID, the inverse lookup surfaces every D3FEND ID that nominally covers behavior the framework control claims — and via the catalog's `lag_notes`, the grain mismatch that makes the framework claim insufficient. This cross-walk is the most operator-facing one: it converts "we have CM-7" into "CM-7 nominally claims coverage of D3-EAL behavior, but the catalog's lag note records that auditors accept inventory-only CM-7 implementations, which is not D3-EAL — operationalize the runtime-blocking behavior or document the gap."
297
+
298
+ - **DLP / exfil → D3FEND.** Sourced from `data/dlp-controls.json`, whose entries carry a `d3fend_refs` field linking each DLP technique to the D3FEND countermeasures that detect or isolate the corresponding exfil pattern. The DLP catalog is the dedicated link for the Detect and Isolate tactics in data-loss scenarios.
299
+
300
+ When a new offensive technique is added to `data/atlas-ttps.json` or referenced in a new CVE in `data/cve-catalog.json`, the catalog steward must ensure at least one D3FEND entry covers it via `counters_attack_techniques`, or open a gap entry in `data/d3fend-catalog.json` per AGENTS.md hard rule #4 (no orphaned controls — by inversion, no orphaned attack techniques). This skill is the consumer that surfaces the inversion failure if the catalog drifts.