security-detections-mcp 1.3.0 → 1.4.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.
- package/README.md +401 -18
- package/dist/db.d.ts +10 -0
- package/dist/db.js +101 -0
- package/dist/index.js +2669 -65
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -4,8 +4,73 @@ An MCP (Model Context Protocol) server that lets LLMs query a unified database o
|
|
|
4
4
|
|
|
5
5
|
[](https://cursor.com/en/install-mcp?name=security-detections&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInNlY3VyaXR5LWRldGVjdGlvbnMtbWNwIl0sImVudiI6eyJTSUdNQV9QQVRIUyI6Ii9wYXRoL3RvL3NpZ21hL3J1bGVzLC9wYXRoL3RvL3NpZ21hL3J1bGVzLXRocmVhdC1odW50aW5nIiwiU1BMVU5LX1BBVEhTIjoiL3BhdGgvdG8vc2VjdXJpdHlfY29udGVudC9kZXRlY3Rpb25zIiwiU1RPUllfUEFUSFMiOiIvcGF0aC90by9zZWN1cml0eV9jb250ZW50L3N0b3JpZXMiLCJFTEFTVElDX1BBVEhTIjoiL3BhdGgvdG8vZGV0ZWN0aW9uLXJ1bGVzL3J1bGVzIiwiS1FMX1BBVEhTIjoiL3BhdGgvdG8va3FsLXJ1bGVzIn19)
|
|
6
6
|
|
|
7
|
+
## 🆕 MCP Prompts - Expert Detection Workflows
|
|
8
|
+
|
|
9
|
+
This server includes **11 pre-built MCP Prompts** that provide structured, expert-level workflows for common security detection tasks. Instead of figuring out which tools to use and in what order, just ask for a prompt by name and get a comprehensive, professional analysis.
|
|
10
|
+
|
|
11
|
+
### How to Use Prompts in Cursor
|
|
12
|
+
|
|
13
|
+
Simply ask Claude to use a prompt by name:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
You: "Use the ransomware-readiness-assessment prompt"
|
|
17
|
+
You: "Run apt-threat-emulation for APT29"
|
|
18
|
+
You: "Execute the executive-security-briefing prompt for our CISO"
|
|
19
|
+
You: "Use detection-engineering-sprint with capacity 5 and focus on ransomware"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Available Prompts
|
|
23
|
+
|
|
24
|
+
| Prompt | Description | Arguments |
|
|
25
|
+
|--------|-------------|-----------|
|
|
26
|
+
| `ransomware-readiness-assessment` | Comprehensive kill-chain analysis with risk scoring and remediation roadmap | `priority_focus`: prevention/detection/response/all |
|
|
27
|
+
| `apt-threat-emulation` | Assess coverage against specific threat actors (APT29, Lazarus, Volt Typhoon, etc.) | `threat_actor` (required), `include_test_plan` |
|
|
28
|
+
| `purple-team-exercise` | Generate complete test plans with procedures and expected detections | `scope` (tactic or technique), `environment` |
|
|
29
|
+
| `soc-investigation-assist` | Investigation helper with triage guidance, hunting queries, and escalation criteria | `indicator` (required), `context` |
|
|
30
|
+
| `detection-engineering-sprint` | Prioritized detection backlog with user stories and acceptance criteria | `sprint_capacity`, `threat_focus` |
|
|
31
|
+
| `executive-security-briefing` | C-level report with business risk language and investment recommendations | `audience`: board/ciso/cto, `include_benchmarks` |
|
|
32
|
+
| `cve-response-assessment` | Rapid assessment for emerging CVEs and threats | `cve_or_threat` (required) |
|
|
33
|
+
| `data-source-gap-analysis` | Analyze telemetry requirements for improved detection coverage | `target_coverage` |
|
|
34
|
+
| `detection-quality-review` | Deep-dive quality analysis of detections for a specific technique | `technique_id` (required) |
|
|
35
|
+
| `threat-landscape-sync` | Align detection priorities with current threat landscape | `industry` |
|
|
36
|
+
| `detection-coverage-diff` | Compare coverage against threat actors or baseline | `compare_against` (required) |
|
|
37
|
+
|
|
38
|
+
### Example: Ransomware Assessment
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
You: "Use the ransomware-readiness-assessment prompt"
|
|
42
|
+
|
|
43
|
+
Claude will automatically:
|
|
44
|
+
1. Get baseline stats with get_stats
|
|
45
|
+
2. Analyze ransomware-specific gaps with identify_gaps
|
|
46
|
+
3. Review coverage by tactic with analyze_coverage
|
|
47
|
+
4. Map gaps to the ransomware kill chain
|
|
48
|
+
5. Generate prioritized remediation roadmap
|
|
49
|
+
6. Output a professional report with risk scores
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Example: APT Threat Assessment
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
You: "Run apt-threat-emulation for Volt Typhoon"
|
|
56
|
+
|
|
57
|
+
Claude will:
|
|
58
|
+
1. Research Volt Typhoon using MITRE ATT&CK data
|
|
59
|
+
2. Get all 81 techniques attributed to the group
|
|
60
|
+
3. Check your detection coverage for each technique
|
|
61
|
+
4. Calculate coverage percentage and identify blind spots
|
|
62
|
+
5. Generate a purple team test plan (optional)
|
|
63
|
+
6. Provide prioritized detection recommendations
|
|
64
|
+
```
|
|
65
|
+
|
|
7
66
|
## Features
|
|
8
67
|
|
|
68
|
+
- **🆕 MCP Prompts** - 11 pre-built expert workflows for ransomware assessment, APT emulation, purple team exercises, executive briefings, and more
|
|
69
|
+
- **🆕 MCP Resources** - Readable context for LLMs (stats, coverage summary, gaps) without tool calls
|
|
70
|
+
- **🆕 Argument Completions** - Autocomplete for technique IDs, CVEs, process names as you type
|
|
71
|
+
- **🆕 Server Instructions** - Built-in usage guide with examples for better LLM understanding
|
|
72
|
+
- **🆕 Structured Errors** - Helpful error messages with suggestions and similar items
|
|
73
|
+
- **🆕 Interactive Tools** - Gap prioritization and sprint planning with form-based input (Cursor 0.42+)
|
|
9
74
|
- **Unified Search** - Query Sigma, Splunk ESCU, Elastic, and KQL detections from a single interface
|
|
10
75
|
- **Full-Text Search** - SQLite FTS5 powered search across names, descriptions, queries, MITRE tactics, CVEs, process names, and more
|
|
11
76
|
- **MITRE ATT&CK Mapping** - Filter detections by technique ID or tactic
|
|
@@ -82,6 +147,49 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
82
147
|
}
|
|
83
148
|
}
|
|
84
149
|
```
|
|
150
|
+
### Visual Studio Code
|
|
151
|
+
|
|
152
|
+
Add to `~/.vscode/mcp.json`:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"servers": {
|
|
157
|
+
"security-detections": {
|
|
158
|
+
"type": "stdio",
|
|
159
|
+
"command": "npx",
|
|
160
|
+
"args": ["-y", "security-detections-mcp"],
|
|
161
|
+
"env": {
|
|
162
|
+
"SIGMA_PATHS": "/Users/you/sigma/rules,/Users/you/sigma/rules-threat-hunting",
|
|
163
|
+
"SPLUNK_PATHS": "/Users/you/security_content/detections",
|
|
164
|
+
"ELASTIC_PATHS": "/Users/you/detection-rules/rules",
|
|
165
|
+
"KQL_PATHS": "/Users/you/kql-bertjanp,/Users/you/kql-jkerai1",
|
|
166
|
+
"STORY_PATHS": "/Users/you/security_content/stories"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### WSL & Visual Studio Code
|
|
173
|
+
|
|
174
|
+
Add to `~/.vscode/mcp.json`:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"servers": {
|
|
179
|
+
"security-detections": {
|
|
180
|
+
"type": "stdio",
|
|
181
|
+
"command": "wsl",
|
|
182
|
+
"args": ["npx", "-y", "security-detections-mcp"],
|
|
183
|
+
"env": {
|
|
184
|
+
"SIGMA_PATHS": "/Users/you/sigma/rules,/Users/you/sigma/rules-threat-hunting",
|
|
185
|
+
"SPLUNK_PATHS": "/Users/you/security_content/detections",
|
|
186
|
+
"ELASTIC_PATHS": "/Users/you/detection-rules/rules",
|
|
187
|
+
"KQL_PATHS": "/Users/you/kql-bertjanp,/Users/you/kql-jkerai1",
|
|
188
|
+
"STORY_PATHS": "/Users/you/security_content/stories"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
85
193
|
|
|
86
194
|
### Environment Variables
|
|
87
195
|
|
|
@@ -150,6 +258,83 @@ git clone https://github.com/jkerai1/KQL-Queries.git
|
|
|
150
258
|
# Use entire repos, combine paths with comma
|
|
151
259
|
```
|
|
152
260
|
|
|
261
|
+
## 🆕 MCP Resources - Readable Context
|
|
262
|
+
|
|
263
|
+
MCP Resources let LLMs read context directly without tool calls. Perfect for understanding the current state before making decisions.
|
|
264
|
+
|
|
265
|
+
### Available Resources
|
|
266
|
+
|
|
267
|
+
| Resource URI | Description |
|
|
268
|
+
|-------------|-------------|
|
|
269
|
+
| `detection://stats` | Current inventory statistics |
|
|
270
|
+
| `detection://coverage-summary` | Tactic-by-tactic coverage percentages |
|
|
271
|
+
| `detection://gaps/ransomware` | Current ransomware detection gaps |
|
|
272
|
+
| `detection://gaps/apt` | Current APT detection gaps |
|
|
273
|
+
| `detection://top-techniques` | Top 20 techniques with most coverage |
|
|
274
|
+
|
|
275
|
+
Resources are automatically available in Cursor's context when needed.
|
|
276
|
+
|
|
277
|
+
## 🆕 Argument Completions
|
|
278
|
+
|
|
279
|
+
The server provides **autocomplete suggestions** as you type argument values:
|
|
280
|
+
|
|
281
|
+
| Argument | Completions From |
|
|
282
|
+
|----------|-----------------|
|
|
283
|
+
| `technique_id` | Your indexed MITRE technique IDs (T1059.001, etc.) |
|
|
284
|
+
| `cve_id` | Your indexed CVE IDs (CVE-2024-27198, etc.) |
|
|
285
|
+
| `process_name` | Process names in your detections (powershell.exe, etc.) |
|
|
286
|
+
| `tactic` | All 14 MITRE tactics |
|
|
287
|
+
| `severity` | informational, low, medium, high, critical |
|
|
288
|
+
| `source_type` | sigma, splunk_escu, elastic, kql |
|
|
289
|
+
| `threat_profile` | ransomware, apt, initial-access, persistence, etc. |
|
|
290
|
+
|
|
291
|
+
This prevents typos and helps discover what values are available in your detection corpus.
|
|
292
|
+
|
|
293
|
+
## 🆕 Structured Errors & Suggestions
|
|
294
|
+
|
|
295
|
+
When errors occur or no results are found, the server returns **helpful JSON responses** instead of plain strings:
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
// Missing required argument
|
|
299
|
+
{
|
|
300
|
+
"error": true,
|
|
301
|
+
"code": "MISSING_REQUIRED_ARG",
|
|
302
|
+
"message": "technique_id is required",
|
|
303
|
+
"examples": ["T1059.001", "T1547.001", "T1003.001"],
|
|
304
|
+
"hint": "Use format T####.### (e.g., T1059.001 for PowerShell)"
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// No results found
|
|
308
|
+
{
|
|
309
|
+
"results": [],
|
|
310
|
+
"technique_id": "T1234.999",
|
|
311
|
+
"suggestions": {
|
|
312
|
+
"message": "No detections found for this technique",
|
|
313
|
+
"similar_techniques": ["T1234.001", "T1234.002"],
|
|
314
|
+
"try_search": "search(\"T1234\") for broader results",
|
|
315
|
+
"tip": "Parent techniques (T1234) may catch sub-techniques"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
This helps LLMs self-correct and suggest alternatives without getting stuck.
|
|
321
|
+
|
|
322
|
+
## 🆕 Interactive Tools (Cursor 0.42+)
|
|
323
|
+
|
|
324
|
+
These tools use **MCP Elicitation** to present forms for interactive configuration:
|
|
325
|
+
|
|
326
|
+
| Tool | Description |
|
|
327
|
+
|------|-------------|
|
|
328
|
+
| `prioritize_gaps` | Analyze gaps and get prioritized recommendations |
|
|
329
|
+
| `plan_detection_sprint` | Interactive sprint configuration with capacity/focus/data source options |
|
|
330
|
+
|
|
331
|
+
Example:
|
|
332
|
+
```
|
|
333
|
+
You: "Help me prioritize which ransomware gaps to fix first"
|
|
334
|
+
Tool: prioritize_gaps(threat_profile="ransomware")
|
|
335
|
+
→ Returns P0/P1/P2 prioritized gaps with selection guidance
|
|
336
|
+
```
|
|
337
|
+
|
|
153
338
|
## MCP Tools
|
|
154
339
|
|
|
155
340
|
### Core Detection Tools
|
|
@@ -215,10 +400,162 @@ These tools do heavy processing server-side and return minimal, actionable data:
|
|
|
215
400
|
| `identify_gaps(threat_profile, source_type?)` | Find gaps for ransomware, apt, persistence, etc. | ~500B |
|
|
216
401
|
| `suggest_detections(technique_id, source_type?)` | Get detection ideas for a technique | ~2KB |
|
|
217
402
|
| `get_technique_ids(source_type?, tactic?, severity?)` | Get only technique IDs (no full objects) | ~200B |
|
|
218
|
-
| `
|
|
403
|
+
| `get_coverage_summary(source_type?)` | Just tactic percentages (~200 bytes) | ~200B |
|
|
404
|
+
| `get_top_gaps(threat_profile)` | Just top 5 gap technique IDs (~300 bytes) | ~300B |
|
|
405
|
+
| `get_technique_count(technique_id)` | Just the count for one technique (~50 bytes) | ~50B |
|
|
219
406
|
|
|
220
407
|
**Why use these?** Traditional tools return full detection objects (~50KB+ per query). These return only what you need, saving 25x+ tokens.
|
|
221
408
|
|
|
409
|
+
### Interactive Tools
|
|
410
|
+
|
|
411
|
+
| Tool | Description |
|
|
412
|
+
|------|-------------|
|
|
413
|
+
| `prioritize_gaps(threat_profile, source_type?)` | Analyze gaps with P0/P1/P2 prioritization and selection guidance |
|
|
414
|
+
| `plan_detection_sprint()` | Generate sprint configuration options with recommended backlog |
|
|
415
|
+
|
|
416
|
+
## MCP Prompts - Detailed Reference
|
|
417
|
+
|
|
418
|
+
MCP Prompts are pre-built, expert-level workflows that guide Claude through complex analysis tasks. They ensure consistent, comprehensive results by defining exactly which tools to use and in what order.
|
|
419
|
+
|
|
420
|
+
### Why Use Prompts Instead of Ad-Hoc Questions?
|
|
421
|
+
|
|
422
|
+
| Ad-Hoc Question | With MCP Prompt |
|
|
423
|
+
|-----------------|-----------------|
|
|
424
|
+
| "Check my ransomware coverage" | "Use ransomware-readiness-assessment" |
|
|
425
|
+
| Claude might check 2-3 things | Claude executes 15+ step workflow |
|
|
426
|
+
| Inconsistent output format | Professional report with risk scores |
|
|
427
|
+
| May miss important aspects | Comprehensive kill-chain analysis |
|
|
428
|
+
| Varies each time | Repeatable, auditable results |
|
|
429
|
+
|
|
430
|
+
### Prompt Categories
|
|
431
|
+
|
|
432
|
+
#### 🎯 Threat Assessment Prompts
|
|
433
|
+
|
|
434
|
+
**`ransomware-readiness-assessment`**
|
|
435
|
+
- Full ransomware kill-chain analysis
|
|
436
|
+
- Risk scoring per attack phase
|
|
437
|
+
- Prioritized remediation roadmap
|
|
438
|
+
- Executive-ready reporting
|
|
439
|
+
|
|
440
|
+
```
|
|
441
|
+
Use ransomware-readiness-assessment with priority_focus "detection"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
**`apt-threat-emulation`**
|
|
445
|
+
- Coverage analysis against specific threat actors
|
|
446
|
+
- Technique-by-technique gap identification
|
|
447
|
+
- Optional purple team test plan generation
|
|
448
|
+
- Supports all MITRE ATT&CK groups (APT29, Lazarus, Volt Typhoon, Scattered Spider, etc.)
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
Run apt-threat-emulation for "Scattered Spider" with include_test_plan true
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**`threat-landscape-sync`**
|
|
455
|
+
- Align detections with current threats
|
|
456
|
+
- Industry-specific threat prioritization
|
|
457
|
+
- Top actor coverage analysis
|
|
458
|
+
- Strategic roadmap generation
|
|
459
|
+
|
|
460
|
+
```
|
|
461
|
+
Use threat-landscape-sync for the finance industry
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
#### 🔬 Purple Team & Validation Prompts
|
|
465
|
+
|
|
466
|
+
**`purple-team-exercise`**
|
|
467
|
+
- Complete exercise planning for a tactic or technique
|
|
468
|
+
- Test case development with procedures
|
|
469
|
+
- Expected detection mapping
|
|
470
|
+
- Safety controls and rollback plans
|
|
471
|
+
|
|
472
|
+
```
|
|
473
|
+
Run purple-team-exercise for "persistence" in a "windows" environment
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**`detection-quality-review`**
|
|
477
|
+
- Deep-dive analysis of detection effectiveness
|
|
478
|
+
- Bypass and evasion analysis
|
|
479
|
+
- Quality scoring and improvement recommendations
|
|
480
|
+
- Enhanced detection logic suggestions
|
|
481
|
+
|
|
482
|
+
```
|
|
483
|
+
Use detection-quality-review for T1059.001
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
#### 📊 Planning & Reporting Prompts
|
|
487
|
+
|
|
488
|
+
**`detection-engineering-sprint`**
|
|
489
|
+
- Threat-informed backlog prioritization
|
|
490
|
+
- User stories with acceptance criteria
|
|
491
|
+
- Effort estimation and capacity planning
|
|
492
|
+
- Focus areas: ransomware, apt, insider, cloud, balanced
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
Run detection-engineering-sprint with sprint_capacity 5 and threat_focus "apt"
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
**`executive-security-briefing`**
|
|
499
|
+
- Business-risk translation
|
|
500
|
+
- Coverage metrics and trends
|
|
501
|
+
- Investment recommendations with ROI
|
|
502
|
+
- Audience-specific formatting (board, CISO, CTO)
|
|
503
|
+
|
|
504
|
+
```
|
|
505
|
+
Use executive-security-briefing for audience "board" with include_benchmarks true
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
#### 🚨 Incident Response Prompts
|
|
509
|
+
|
|
510
|
+
**`soc-investigation-assist`**
|
|
511
|
+
- Alert triage guidance
|
|
512
|
+
- MITRE ATT&CK context
|
|
513
|
+
- Related detections and hunting queries
|
|
514
|
+
- Escalation decision trees
|
|
515
|
+
|
|
516
|
+
```
|
|
517
|
+
Use soc-investigation-assist for "suspicious PowerShell execution" with context "domain controller, after hours"
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
**`cve-response-assessment`**
|
|
521
|
+
- Rapid threat assessment
|
|
522
|
+
- Existing coverage check
|
|
523
|
+
- Immediate action recommendations
|
|
524
|
+
- Hunting query generation
|
|
525
|
+
|
|
526
|
+
```
|
|
527
|
+
Run cve-response-assessment for CVE-2024-27198
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### 🔧 Gap Analysis Prompts
|
|
531
|
+
|
|
532
|
+
**`data-source-gap-analysis`**
|
|
533
|
+
- Telemetry requirements analysis
|
|
534
|
+
- Data source prioritization by ROI
|
|
535
|
+
- Implementation roadmap
|
|
536
|
+
- Cost-benefit analysis
|
|
537
|
+
|
|
538
|
+
```
|
|
539
|
+
Use data-source-gap-analysis for target_coverage "credential-access"
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
**`detection-coverage-diff`**
|
|
543
|
+
- Compare against threat actors or baselines
|
|
544
|
+
- Progress tracking
|
|
545
|
+
- Path-to-parity planning
|
|
546
|
+
- Effort estimation
|
|
547
|
+
|
|
548
|
+
```
|
|
549
|
+
Run detection-coverage-diff comparing against "APT29"
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Best With: MITRE ATT&CK MCP
|
|
553
|
+
|
|
554
|
+
These prompts work even better when paired with [mitre-attack-mcp](https://github.com/MHaggis/mitre-attack-mcp). The prompts will automatically leverage MITRE ATT&CK tools for:
|
|
555
|
+
- Threat actor technique lookups
|
|
556
|
+
- Technique details and detection guidance
|
|
557
|
+
- Mitigation recommendations
|
|
558
|
+
|
|
222
559
|
## Claude Code Skills
|
|
223
560
|
|
|
224
561
|
This repo includes [Claude Code Skills](https://code.claude.com/docs/en/skills) in `.claude/skills/` that teach Claude efficient workflows:
|
|
@@ -246,21 +583,43 @@ Total: ~5KB of data vs ~500KB with traditional tools
|
|
|
246
583
|
|
|
247
584
|
## Example Workflows
|
|
248
585
|
|
|
249
|
-
###
|
|
586
|
+
### Using MCP Prompts (Recommended for Complex Tasks)
|
|
587
|
+
|
|
588
|
+
```
|
|
589
|
+
# Comprehensive ransomware assessment
|
|
590
|
+
You: "Use the ransomware-readiness-assessment prompt"
|
|
591
|
+
→ Full kill-chain analysis with risk scoring and remediation roadmap
|
|
592
|
+
|
|
593
|
+
# Assess coverage against a specific APT
|
|
594
|
+
You: "Run apt-threat-emulation for Volt Typhoon"
|
|
595
|
+
→ Technique-by-technique coverage analysis with test plan
|
|
596
|
+
|
|
597
|
+
# Generate a sprint backlog
|
|
598
|
+
You: "Use detection-engineering-sprint with capacity 5 focusing on apt threats"
|
|
599
|
+
→ Prioritized user stories with acceptance criteria
|
|
600
|
+
|
|
601
|
+
# Executive reporting
|
|
602
|
+
You: "Run executive-security-briefing for the board"
|
|
603
|
+
→ Business-risk language with investment recommendations
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
### Using Tools Directly (Quick Queries)
|
|
607
|
+
|
|
608
|
+
#### Find PowerShell Detections
|
|
250
609
|
|
|
251
610
|
```
|
|
252
611
|
LLM: "Find me PowerShell detections related to base64 encoding"
|
|
253
612
|
Tool: search(query="powershell base64", limit=5)
|
|
254
613
|
```
|
|
255
614
|
|
|
256
|
-
|
|
615
|
+
#### Check CVE Coverage
|
|
257
616
|
|
|
258
617
|
```
|
|
259
618
|
LLM: "Do we have detections for CVE-2024-27198?"
|
|
260
619
|
Tool: list_by_cve(cve_id="CVE-2024-27198")
|
|
261
620
|
```
|
|
262
621
|
|
|
263
|
-
|
|
622
|
+
#### Compare Coverage Across Sources
|
|
264
623
|
|
|
265
624
|
```
|
|
266
625
|
LLM: "What detections do we have for credential dumping?"
|
|
@@ -268,14 +627,14 @@ Tool: search(query="credential dumping", limit=10)
|
|
|
268
627
|
→ Returns results from Sigma, Splunk, Elastic, AND KQL
|
|
269
628
|
```
|
|
270
629
|
|
|
271
|
-
|
|
630
|
+
#### Find Web Server Attack Detections
|
|
272
631
|
|
|
273
632
|
```
|
|
274
633
|
LLM: "What detections cover IIS web server attacks?"
|
|
275
634
|
Tool: list_by_process_name(process_name="w3wp.exe")
|
|
276
635
|
```
|
|
277
636
|
|
|
278
|
-
|
|
637
|
+
#### Explore a Threat Campaign
|
|
279
638
|
|
|
280
639
|
```
|
|
281
640
|
LLM: "Tell me about ransomware detections"
|
|
@@ -283,14 +642,14 @@ Tool: search_stories(query="ransomware")
|
|
|
283
642
|
Tool: list_by_analytic_story(story="Ransomware")
|
|
284
643
|
```
|
|
285
644
|
|
|
286
|
-
|
|
645
|
+
#### Find KQL Hunting Queries for Defender
|
|
287
646
|
|
|
288
647
|
```
|
|
289
648
|
LLM: "What KQL queries do we have for Defender For Endpoint?"
|
|
290
649
|
Tool: list_by_kql_category(category="Defender For Endpoint")
|
|
291
650
|
```
|
|
292
651
|
|
|
293
|
-
|
|
652
|
+
#### Search for BloodHound Detections
|
|
294
653
|
|
|
295
654
|
```
|
|
296
655
|
LLM: "Find detections for BloodHound usage"
|
|
@@ -431,10 +790,36 @@ When fully indexed with all sources:
|
|
|
431
790
|
|
|
432
791
|
| MCP | Purpose |
|
|
433
792
|
|-----|---------|
|
|
434
|
-
| **security-detections-mcp** | Query 7,200+ detection rules
|
|
435
|
-
| **mitre-attack-mcp** |
|
|
793
|
+
| **security-detections-mcp** | Query 7,200+ detection rules + 11 expert workflow prompts |
|
|
794
|
+
| **mitre-attack-mcp** | ATT&CK framework data, threat groups, Navigator layers |
|
|
795
|
+
|
|
796
|
+
### With MCP Prompts (Easiest)
|
|
797
|
+
|
|
798
|
+
The prompts automatically leverage both MCPs for comprehensive analysis:
|
|
799
|
+
|
|
800
|
+
```
|
|
801
|
+
You: "Run apt-threat-emulation for APT29"
|
|
802
|
+
|
|
803
|
+
The prompt automatically:
|
|
804
|
+
1. Uses mitre-attack-mcp to get APT29's profile and techniques
|
|
805
|
+
2. Uses security-detections-mcp to check coverage for each technique
|
|
806
|
+
3. Calculates coverage percentage and identifies gaps
|
|
807
|
+
4. Generates purple team test plan
|
|
808
|
+
5. Outputs professional report with recommendations
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
```
|
|
812
|
+
You: "Use threat-landscape-sync for the finance industry"
|
|
813
|
+
|
|
814
|
+
The prompt automatically:
|
|
815
|
+
1. Gets top threat actors from mitre-attack-mcp
|
|
816
|
+
2. Filters by industry relevance
|
|
817
|
+
3. Analyzes your coverage against each actor
|
|
818
|
+
4. Prioritizes detection investments
|
|
819
|
+
5. Creates strategic roadmap
|
|
820
|
+
```
|
|
436
821
|
|
|
437
|
-
###
|
|
822
|
+
### With Tools Directly (More Control)
|
|
438
823
|
|
|
439
824
|
```
|
|
440
825
|
You: "What's my coverage against APT29?"
|
|
@@ -447,21 +832,19 @@ LLM workflow (3 calls, ~10KB total):
|
|
|
447
832
|
Result: Prioritized gap list, not 500KB of raw data
|
|
448
833
|
```
|
|
449
834
|
|
|
450
|
-
### Generate Navigator Layer
|
|
835
|
+
### Generate Navigator Layer
|
|
451
836
|
|
|
452
837
|
```
|
|
453
838
|
You: "Generate a Navigator layer for my initial access coverage"
|
|
454
839
|
|
|
455
|
-
LLM:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
tactic="initial-access"
|
|
459
|
-
)
|
|
840
|
+
LLM workflow:
|
|
841
|
+
1. detections-mcp → get_technique_ids(tactic="initial-access") # Get covered technique IDs
|
|
842
|
+
2. mitre-attack-mcp → generate_coverage_layer(covered_ids, "Initial Access Coverage")
|
|
460
843
|
|
|
461
844
|
→ Returns ready-to-import Navigator JSON
|
|
462
845
|
```
|
|
463
846
|
|
|
464
|
-
### Install Both Together
|
|
847
|
+
### Install Both Together (Recommended)
|
|
465
848
|
|
|
466
849
|
```json
|
|
467
850
|
{
|
package/dist/db.d.ts
CHANGED
|
@@ -32,6 +32,16 @@ export declare function searchStories(query: string, limit?: number): AnalyticSt
|
|
|
32
32
|
export declare function listStories(limit?: number, offset?: number): AnalyticStory[];
|
|
33
33
|
export declare function listStoriesByCategory(category: string, limit?: number, offset?: number): AnalyticStory[];
|
|
34
34
|
export declare function getStoryCount(): number;
|
|
35
|
+
export declare function getDistinctTechniqueIds(prefix: string, limit?: number): string[];
|
|
36
|
+
export declare function getDistinctCves(prefix: string, limit?: number): string[];
|
|
37
|
+
export declare function getDistinctProcessNames(prefix: string, limit?: number): string[];
|
|
38
|
+
export interface ValidationResult {
|
|
39
|
+
valid: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
suggestion?: string;
|
|
42
|
+
similar?: string[];
|
|
43
|
+
}
|
|
44
|
+
export declare function validateTechniqueId(id: string): ValidationResult;
|
|
35
45
|
export interface TechniqueIdFilters {
|
|
36
46
|
source_type?: 'sigma' | 'splunk_escu' | 'elastic';
|
|
37
47
|
tactic?: string;
|
package/dist/db.js
CHANGED
|
@@ -581,6 +581,107 @@ export function getStoryCount() {
|
|
|
581
581
|
return 0;
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
+
// =============================================================================
|
|
585
|
+
// COMPLETION HELPER FUNCTIONS - For autocomplete suggestions
|
|
586
|
+
// =============================================================================
|
|
587
|
+
export function getDistinctTechniqueIds(prefix, limit = 10) {
|
|
588
|
+
const database = initDb();
|
|
589
|
+
// Get all technique IDs and filter by prefix
|
|
590
|
+
const rows = database.prepare(`
|
|
591
|
+
SELECT DISTINCT mitre_ids FROM detections
|
|
592
|
+
WHERE mitre_ids != '[]' AND mitre_ids IS NOT NULL
|
|
593
|
+
`).all();
|
|
594
|
+
const techniqueSet = new Set();
|
|
595
|
+
for (const row of rows) {
|
|
596
|
+
const ids = JSON.parse(row.mitre_ids);
|
|
597
|
+
for (const id of ids) {
|
|
598
|
+
if (id.toUpperCase().startsWith(prefix.toUpperCase())) {
|
|
599
|
+
techniqueSet.add(id);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return Array.from(techniqueSet).sort().slice(0, limit);
|
|
604
|
+
}
|
|
605
|
+
export function getDistinctCves(prefix, limit = 10) {
|
|
606
|
+
const database = initDb();
|
|
607
|
+
// Get all CVEs and filter by prefix
|
|
608
|
+
const rows = database.prepare(`
|
|
609
|
+
SELECT DISTINCT cves FROM detections
|
|
610
|
+
WHERE cves != '[]' AND cves IS NOT NULL
|
|
611
|
+
`).all();
|
|
612
|
+
const cveSet = new Set();
|
|
613
|
+
for (const row of rows) {
|
|
614
|
+
const cvelist = JSON.parse(row.cves);
|
|
615
|
+
for (const cve of cvelist) {
|
|
616
|
+
if (cve.toUpperCase().startsWith(prefix.toUpperCase())) {
|
|
617
|
+
cveSet.add(cve);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return Array.from(cveSet).sort().slice(0, limit);
|
|
622
|
+
}
|
|
623
|
+
export function getDistinctProcessNames(prefix, limit = 10) {
|
|
624
|
+
const database = initDb();
|
|
625
|
+
// Get all process names and filter by prefix
|
|
626
|
+
const rows = database.prepare(`
|
|
627
|
+
SELECT DISTINCT process_names FROM detections
|
|
628
|
+
WHERE process_names != '[]' AND process_names IS NOT NULL
|
|
629
|
+
`).all();
|
|
630
|
+
const processSet = new Set();
|
|
631
|
+
for (const row of rows) {
|
|
632
|
+
const procs = JSON.parse(row.process_names);
|
|
633
|
+
for (const proc of procs) {
|
|
634
|
+
if (proc.toLowerCase().startsWith(prefix.toLowerCase())) {
|
|
635
|
+
processSet.add(proc);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return Array.from(processSet).sort().slice(0, limit);
|
|
640
|
+
}
|
|
641
|
+
export function validateTechniqueId(id) {
|
|
642
|
+
// Check format: T followed by 4 digits, optionally .3 more digits
|
|
643
|
+
if (!id.match(/^T\d{4}(\.\d{3})?$/)) {
|
|
644
|
+
return {
|
|
645
|
+
valid: false,
|
|
646
|
+
error: 'Invalid technique ID format',
|
|
647
|
+
suggestion: 'Use format T####.### (e.g., T1059.001)'
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
const database = initDb();
|
|
651
|
+
// Check if this exact technique has detections
|
|
652
|
+
const exact = database.prepare(`
|
|
653
|
+
SELECT 1 FROM detections WHERE mitre_ids LIKE ? LIMIT 1
|
|
654
|
+
`).get(`%"${id}"%`);
|
|
655
|
+
if (exact) {
|
|
656
|
+
return { valid: true };
|
|
657
|
+
}
|
|
658
|
+
// Find similar techniques that we DO have
|
|
659
|
+
const similar = getDistinctTechniqueIds(id.substring(0, 5), 5);
|
|
660
|
+
// Also check if we have parent or sub-techniques
|
|
661
|
+
const baseId = id.split('.')[0];
|
|
662
|
+
const parentMatch = database.prepare(`
|
|
663
|
+
SELECT 1 FROM detections WHERE mitre_ids LIKE ? LIMIT 1
|
|
664
|
+
`).get(`%"${baseId}"%`);
|
|
665
|
+
if (parentMatch) {
|
|
666
|
+
return {
|
|
667
|
+
valid: true,
|
|
668
|
+
suggestion: `No exact match for ${id}, but found coverage for ${baseId}`,
|
|
669
|
+
similar: similar.length > 0 ? similar : undefined,
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
if (similar.length > 0) {
|
|
673
|
+
return {
|
|
674
|
+
valid: false,
|
|
675
|
+
error: `No detections found for ${id}`,
|
|
676
|
+
suggestion: 'Try one of the similar techniques',
|
|
677
|
+
similar,
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
return {
|
|
681
|
+
valid: true,
|
|
682
|
+
suggestion: `No existing detections for ${id} - this is a gap`,
|
|
683
|
+
};
|
|
684
|
+
}
|
|
584
685
|
export function getTechniqueIds(filters = {}) {
|
|
585
686
|
const database = initDb();
|
|
586
687
|
let sql = "SELECT DISTINCT mitre_ids FROM detections WHERE mitre_ids != '[]' AND mitre_ids IS NOT NULL";
|