dns-security-mcp 0.1.0

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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +723 -0
  3. package/dist/blocklist/index.d.ts +3 -0
  4. package/dist/blocklist/index.d.ts.map +1 -0
  5. package/dist/blocklist/index.js +596 -0
  6. package/dist/blocklist/index.js.map +1 -0
  7. package/dist/ct/index.d.ts +3 -0
  8. package/dist/ct/index.d.ts.map +1 -0
  9. package/dist/ct/index.js +534 -0
  10. package/dist/ct/index.js.map +1 -0
  11. package/dist/data/dkim-selectors.d.ts +2 -0
  12. package/dist/data/dkim-selectors.d.ts.map +1 -0
  13. package/dist/data/dkim-selectors.js +60 -0
  14. package/dist/data/dkim-selectors.js.map +1 -0
  15. package/dist/data/dnsbl-lists.d.ts +8 -0
  16. package/dist/data/dnsbl-lists.d.ts.map +1 -0
  17. package/dist/data/dnsbl-lists.js +54 -0
  18. package/dist/data/dnsbl-lists.js.map +1 -0
  19. package/dist/data/takeover-fingerprints.d.ts +8 -0
  20. package/dist/data/takeover-fingerprints.d.ts.map +1 -0
  21. package/dist/data/takeover-fingerprints.js +84 -0
  22. package/dist/data/takeover-fingerprints.js.map +1 -0
  23. package/dist/data/tunneling-signatures.d.ts +17 -0
  24. package/dist/data/tunneling-signatures.d.ts.map +1 -0
  25. package/dist/data/tunneling-signatures.js +85 -0
  26. package/dist/data/tunneling-signatures.js.map +1 -0
  27. package/dist/dns/index.d.ts +3 -0
  28. package/dist/dns/index.d.ts.map +1 -0
  29. package/dist/dns/index.js +1211 -0
  30. package/dist/dns/index.js.map +1 -0
  31. package/dist/dnssec/index.d.ts +3 -0
  32. package/dist/dnssec/index.d.ts.map +1 -0
  33. package/dist/dnssec/index.js +1377 -0
  34. package/dist/dnssec/index.js.map +1 -0
  35. package/dist/domain/index.d.ts +3 -0
  36. package/dist/domain/index.d.ts.map +1 -0
  37. package/dist/domain/index.js +938 -0
  38. package/dist/domain/index.js.map +1 -0
  39. package/dist/email/index.d.ts +3 -0
  40. package/dist/email/index.d.ts.map +1 -0
  41. package/dist/email/index.js +1188 -0
  42. package/dist/email/index.js.map +1 -0
  43. package/dist/hijack/index.d.ts +3 -0
  44. package/dist/hijack/index.d.ts.map +1 -0
  45. package/dist/hijack/index.js +1117 -0
  46. package/dist/hijack/index.js.map +1 -0
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +151 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/infra/index.d.ts +3 -0
  52. package/dist/infra/index.d.ts.map +1 -0
  53. package/dist/infra/index.js +797 -0
  54. package/dist/infra/index.js.map +1 -0
  55. package/dist/privacy/index.d.ts +3 -0
  56. package/dist/privacy/index.d.ts.map +1 -0
  57. package/dist/privacy/index.js +772 -0
  58. package/dist/privacy/index.js.map +1 -0
  59. package/dist/protocol/mcp-server.d.ts +4 -0
  60. package/dist/protocol/mcp-server.d.ts.map +1 -0
  61. package/dist/protocol/mcp-server.js +32 -0
  62. package/dist/protocol/mcp-server.js.map +1 -0
  63. package/dist/protocol/tools.d.ts +3 -0
  64. package/dist/protocol/tools.d.ts.map +1 -0
  65. package/dist/protocol/tools.js +29 -0
  66. package/dist/protocol/tools.js.map +1 -0
  67. package/dist/report/index.d.ts +3 -0
  68. package/dist/report/index.d.ts.map +1 -0
  69. package/dist/report/index.js +1167 -0
  70. package/dist/report/index.js.map +1 -0
  71. package/dist/threat/index.d.ts +3 -0
  72. package/dist/threat/index.d.ts.map +1 -0
  73. package/dist/threat/index.js +999 -0
  74. package/dist/threat/index.js.map +1 -0
  75. package/dist/tunnel/index.d.ts +3 -0
  76. package/dist/tunnel/index.d.ts.map +1 -0
  77. package/dist/tunnel/index.js +688 -0
  78. package/dist/tunnel/index.js.map +1 -0
  79. package/dist/types/index.d.ts +52 -0
  80. package/dist/types/index.d.ts.map +1 -0
  81. package/dist/types/index.js +8 -0
  82. package/dist/types/index.js.map +1 -0
  83. package/dist/typo/index.d.ts +3 -0
  84. package/dist/typo/index.d.ts.map +1 -0
  85. package/dist/typo/index.js +625 -0
  86. package/dist/typo/index.js.map +1 -0
  87. package/dist/utils/cache.d.ts +11 -0
  88. package/dist/utils/cache.d.ts.map +1 -0
  89. package/dist/utils/cache.js +35 -0
  90. package/dist/utils/cache.js.map +1 -0
  91. package/dist/utils/dns-client.d.ts +37 -0
  92. package/dist/utils/dns-client.d.ts.map +1 -0
  93. package/dist/utils/dns-client.js +359 -0
  94. package/dist/utils/dns-client.js.map +1 -0
  95. package/dist/utils/rate-limiter.d.ts +10 -0
  96. package/dist/utils/rate-limiter.d.ts.map +1 -0
  97. package/dist/utils/rate-limiter.js +35 -0
  98. package/dist/utils/rate-limiter.js.map +1 -0
  99. package/package.json +63 -0
package/README.md ADDED
@@ -0,0 +1,723 @@
1
+ <p align="center">
2
+ <strong>English</strong> |
3
+ <a href="docs/README.zh.md">简体中文</a> |
4
+ <a href="docs/README.zh-TW.md">繁體中文</a> |
5
+ <a href="docs/README.ko.md">한국어</a> |
6
+ <a href="docs/README.de.md">Deutsch</a> |
7
+ <a href="docs/README.es.md">Español</a> |
8
+ <a href="docs/README.fr.md">Français</a> |
9
+ <a href="docs/README.it.md">Italiano</a> |
10
+ <a href="docs/README.da.md">Dansk</a> |
11
+ <a href="docs/README.ja.md">日本語</a> |
12
+ <a href="docs/README.pl.md">Polski</a> |
13
+ <a href="docs/README.ru.md">Русский</a> |
14
+ <a href="docs/README.bs.md">Bosanski</a> |
15
+ <a href="docs/README.ar.md">العربية</a> |
16
+ <a href="docs/README.no.md">Norsk</a> |
17
+ <a href="docs/README.pt-BR.md">Português (Brasil)</a> |
18
+ <a href="docs/README.th.md">ไทย</a> |
19
+ <a href="docs/README.tr.md">Türkçe</a> |
20
+ <a href="docs/README.uk.md">Українська</a> |
21
+ <a href="docs/README.bn.md">বাংলা</a> |
22
+ <a href="docs/README.el.md">Ελληνικά</a> |
23
+ <a href="docs/README.vi.md">Tiếng Việt</a> |
24
+ <a href="docs/README.hi.md">हिन्दी</a>
25
+ </p>
26
+
27
+ <p align="center">
28
+ <br>
29
+ <picture>
30
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/badchars/dns-security-mcp/main/docs/banner-dark.svg">
31
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/badchars/dns-security-mcp/main/docs/banner-light.svg">
32
+ <img alt="dns-security-mcp" src="https://raw.githubusercontent.com/badchars/dns-security-mcp/main/docs/banner-dark.svg" width="700">
33
+ </picture>
34
+ </p>
35
+
36
+ <h3 align="center">The most comprehensive DNS security toolkit for AI agents.</h3>
37
+
38
+ <p align="center">
39
+ DNSSEC validation, subdomain takeover detection, DNS tunneling analysis, typosquatting, email security audit, certificate transparency monitoring, blocklist checking, infrastructure hardening &mdash; unified into a single MCP server.<br>
40
+ <b>103 tools. 13 categories. 3 dependencies. 100% local.</b> No external API calls required for core functionality.
41
+ </p>
42
+
43
+ <br>
44
+
45
+ <p align="center">
46
+ <a href="#the-problem">The Problem</a> &bull;
47
+ <a href="#how-its-different">How It's Different</a> &bull;
48
+ <a href="#quick-start">Quick Start</a> &bull;
49
+ <a href="#what-the-ai-can-do">What The AI Can Do</a> &bull;
50
+ <a href="#tools-reference-103-tools">Tools (103)</a> &bull;
51
+ <a href="#configuration">Configuration</a> &bull;
52
+ <a href="#cli-usage">CLI Usage</a> &bull;
53
+ <a href="#architecture">Architecture</a> &bull;
54
+ <a href="CONTRIBUTING.md">Contributing</a>
55
+ </p>
56
+
57
+ <p align="center">
58
+ <a href="https://www.npmjs.com/package/dns-security-mcp"><img src="https://img.shields.io/npm/v/dns-security-mcp.svg" alt="npm"></a>
59
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
60
+ <img src="https://img.shields.io/badge/tools-103-ef4444" alt="103 Tools">
61
+ <img src="https://img.shields.io/badge/TypeScript-strict-3178c6" alt="TypeScript">
62
+ <img src="https://img.shields.io/badge/protocol-MCP-8b5cf6" alt="MCP">
63
+ <img src="https://img.shields.io/badge/dependencies-3-22c55e" alt="3 Dependencies">
64
+ <img src="https://img.shields.io/badge/API%20keys-optional-f59e0b" alt="API Keys Optional">
65
+ </p>
66
+
67
+ <p align="center">
68
+ <img src="https://raw.githubusercontent.com/badchars/dns-security-mcp/main/docs/demo.gif" alt="dns-security-mcp demo" width="800">
69
+ </p>
70
+
71
+ ---
72
+
73
+ ## The Problem
74
+
75
+ DNS is the foundation of every internet service, and it is the most overlooked attack surface. Misconfigured DNSSEC, dangling CNAME records, missing SPF/DKIM/DMARC, DNS tunneling, typosquatting domains, expiring certificates, open resolvers &mdash; the attack vectors are everywhere, but the tools to detect them are fragmented across dozens of specialized utilities, each with its own syntax, its own output format, and its own learning curve.
76
+
77
+ ```
78
+ Traditional DNS security workflow:
79
+ check DNS records -> dig / nslookup (manual parsing)
80
+ validate DNSSEC -> dnsviz.net web UI + delv CLI
81
+ audit email security -> mxtoolbox.com + dmarcian.com (2 web UIs)
82
+ detect subdomain takeover -> subjack / nuclei + manual CNAME review
83
+ find DNS tunneling -> Wireshark pcap + custom scripts
84
+ monitor certificates -> crt.sh web UI + certspotter
85
+ check typosquatting -> dnstwist CLI + manual review
86
+ scan blocklists -> multirbl.valli.org + spamhaus lookup
87
+ test infrastructure -> multiple CLI tools + web checkers
88
+ generate compliance report -> copy-paste everything into a doc
89
+ ─────────────────────────────────
90
+ Total: 8+ tools, 5+ web UIs, hours of manual correlation
91
+ ```
92
+
93
+ **dns-security-mcp** gives your AI agent 103 tools across 13 categories via the [Model Context Protocol](https://modelcontextprotocol.io). The agent performs DNS reconnaissance, validates DNSSEC chains, audits email authentication, detects hijacking risks, identifies tunneling, monitors certificates, catches typosquatting, checks blocklists, hardens infrastructure, and generates compliance reports &mdash; all in a single conversation, all from local DNS queries.
94
+
95
+ ```
96
+ With dns-security-mcp:
97
+ You: "Run a full security audit on example.com"
98
+
99
+ Agent: -> dns_lookup: 14 record types resolved, 3 nameservers found
100
+ -> dnssec_full_audit: DNSSEC signed, chain valid, RRSIG expires in 12 days
101
+ -> email_full_audit: SPF present (strict), DKIM found (3 selectors),
102
+ DMARC p=reject — excellent email security
103
+ -> hijack_subdomain_takeover: 2 dangling CNAMEs detected (staging, old-api)
104
+ -> ct_unauthorized_detect: 1 certificate from unauthorized CA found
105
+ -> bl_domain_score: Risk score 15/100 — clean
106
+ -> infra_ns_diversity: 4 NS across 3 ASNs — good diversity
107
+ -> report_generate: Full SARIF report generated
108
+
109
+ "example.com has strong DNS and email security posture.
110
+ Two critical findings: staging.example.com and old-api.example.com
111
+ have dangling CNAME records pointing to decommissioned services —
112
+ immediate subdomain takeover risk. One certificate from a non-
113
+ authorized CA (Let's Debug) was found in CT logs. DNSSEC RRSIG
114
+ expires in 12 days — schedule key rotation."
115
+ ```
116
+
117
+ ---
118
+
119
+ ## How It's Different
120
+
121
+ Most DNS tools give you raw records. dns-security-mcp gives your AI agent the ability to **reason across the entire DNS attack surface simultaneously**.
122
+
123
+ <table>
124
+ <thead>
125
+ <tr>
126
+ <th></th>
127
+ <th>Traditional Approach</th>
128
+ <th>dns-security-mcp</th>
129
+ </tr>
130
+ </thead>
131
+ <tbody>
132
+ <tr>
133
+ <td><b>Interface</b></td>
134
+ <td>8+ CLI tools, 5+ web UIs, manual parsing</td>
135
+ <td>MCP &mdash; AI agent calls tools conversationally</td>
136
+ </tr>
137
+ <tr>
138
+ <td><b>Coverage</b></td>
139
+ <td>One category at a time</td>
140
+ <td>13 categories, 103 tools queried in parallel</td>
141
+ </tr>
142
+ <tr>
143
+ <td><b>DNSSEC</b></td>
144
+ <td>dnsviz.net for visualization, delv for validation</td>
145
+ <td>Agent validates full chain of trust, checks DS/DNSKEY/RRSIG/NSEC, audits algorithms, detects key rollover</td>
146
+ </tr>
147
+ <tr>
148
+ <td><b>Email security</b></td>
149
+ <td>mxtoolbox + dmarcian + manual checks</td>
150
+ <td>Agent checks SPF + DKIM (12 selectors) + DMARC + BIMI + MTA-STS + DANE + PTR + spoofability score</td>
151
+ </tr>
152
+ <tr>
153
+ <td><b>Hijacking</b></td>
154
+ <td>subjack for CNAMEs, manual NS/MX review</td>
155
+ <td>Agent checks dangling CNAME + NS + MX, delegation chain, DNS rebinding, registrar security, BGP impact</td>
156
+ </tr>
157
+ <tr>
158
+ <td><b>Tunneling</b></td>
159
+ <td>Wireshark + custom scripts</td>
160
+ <td>Agent runs entropy analysis, length checks, TXT payload detection, tool signatures (iodine, dnscat2, Cobalt Strike), covert channel timing analysis</td>
161
+ </tr>
162
+ <tr>
163
+ <td><b>API keys</b></td>
164
+ <td>Various, often required</td>
165
+ <td>100% local core &mdash; API keys optional for enrichment only</td>
166
+ </tr>
167
+ <tr>
168
+ <td><b>Dependencies</b></td>
169
+ <td>Dozens of tools to install</td>
170
+ <td><code>npx dns-security-mcp</code> &mdash; 3 dependencies, zero config</td>
171
+ </tr>
172
+ <tr>
173
+ <td><b>Output</b></td>
174
+ <td>Raw text, manual correlation</td>
175
+ <td>JSON, Markdown, or SARIF reports &mdash; AI correlates findings automatically</td>
176
+ </tr>
177
+ </tbody>
178
+ </table>
179
+
180
+ ---
181
+
182
+ ## Quick Start
183
+
184
+ ### Option 1: npx (no install)
185
+
186
+ ```bash
187
+ npx dns-security-mcp
188
+ ```
189
+
190
+ All 103 tools work immediately. No API keys required for core functionality &mdash; everything runs via local DNS queries.
191
+
192
+ ### Option 2: bunx (faster)
193
+
194
+ ```bash
195
+ bunx dns-security-mcp
196
+ ```
197
+
198
+ ### Option 3: Clone
199
+
200
+ ```bash
201
+ git clone https://github.com/badchars/dns-security-mcp.git
202
+ cd dns-security-mcp
203
+ bun install
204
+ ```
205
+
206
+ ### Connect to your AI agent
207
+
208
+ <details open>
209
+ <summary><b>Claude Code</b></summary>
210
+
211
+ ```bash
212
+ # With npx
213
+ claude mcp add dns-security-mcp -- npx dns-security-mcp
214
+
215
+ # With local clone
216
+ claude mcp add dns-security-mcp -- bun run /path/to/dns-security-mcp/src/index.ts
217
+ ```
218
+
219
+ </details>
220
+
221
+ <details>
222
+ <summary><b>Claude Desktop</b></summary>
223
+
224
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
225
+
226
+ ```json
227
+ {
228
+ "mcpServers": {
229
+ "dns-security": {
230
+ "command": "npx",
231
+ "args": ["-y", "dns-security-mcp"],
232
+ "env": {
233
+ "SECURITYTRAILS_API_KEY": "optional",
234
+ "VIRUSTOTAL_API_KEY": "optional",
235
+ "SAFEBROWSING_API_KEY": "optional",
236
+ "DNS_RESOLVER": "optional"
237
+ }
238
+ }
239
+ }
240
+ }
241
+ ```
242
+
243
+ </details>
244
+
245
+ <details>
246
+ <summary><b>Cursor / Windsurf / other MCP clients</b></summary>
247
+
248
+ Same JSON config format. Point the command to `npx dns-security-mcp` or your local installation path.
249
+
250
+ </details>
251
+
252
+ ### Start querying
253
+
254
+ ```
255
+ You: "Check if example.com has any DNS security issues"
256
+ ```
257
+
258
+ That's it. The agent runs reconnaissance, validates DNSSEC, checks email security, scans for hijacking risks, and more &mdash; automatically.
259
+
260
+ ---
261
+
262
+ ## What The AI Can Do
263
+
264
+ ### Full Security Audit
265
+
266
+ ```
267
+ You: "Run a comprehensive DNS security audit on target.com"
268
+
269
+ Agent: -> report_full_audit {domain: "target.com"}
270
+ -> "Complete DNS security audit for target.com:
271
+ CRITICAL: 2 dangling CNAMEs (subdomain takeover risk)
272
+ HIGH: DNSSEC not enabled — vulnerable to cache poisoning
273
+ HIGH: DMARC policy is 'none' — email spoofing possible
274
+ MEDIUM: MTA-STS not configured
275
+ LOW: 2 NS servers in same /24 subnet
276
+ Score: 42/100 — significant improvements needed.
277
+ Full SARIF report generated with 8 findings."
278
+ ```
279
+
280
+ ### Email Spoofing Assessment
281
+
282
+ ```
283
+ You: "Can someone spoof emails from our domain bigcorp.com?"
284
+
285
+ Agent: -> email_spoofability_score {domain: "bigcorp.com"}
286
+ -> email_check_spf {domain: "bigcorp.com"}
287
+ -> email_check_dmarc {domain: "bigcorp.com"}
288
+ -> email_check_dkim {domain: "bigcorp.com"}
289
+ -> "Spoofability score: 72/100 (HIGH RISK)
290
+ SPF: Present but uses ~all (softfail) instead of -all
291
+ DKIM: Only 1 selector found (google), missing others
292
+ DMARC: Policy is p=none with no rua reporting
293
+ Recommendation: Change SPF to -all, set DMARC p=reject,
294
+ add DKIM for all sending services."
295
+ ```
296
+
297
+ ### Subdomain Takeover Hunt
298
+
299
+ ```
300
+ You: "Check all subdomains of startup.io for takeover risk"
301
+
302
+ Agent: -> hijack_subdomain_takeover {domain: "startup.io", use_ct: true}
303
+ -> hijack_dangling_cname {domain: "startup.io"}
304
+ -> hijack_dangling_ns {domain: "startup.io"}
305
+ -> hijack_dangling_mx {domain: "startup.io"}
306
+ -> "Found 4 subdomains at risk:
307
+ CRITICAL: docs.startup.io -> CNAME to ReadTheDocs (unclaimed)
308
+ CRITICAL: staging.startup.io -> CNAME to Heroku (app deleted)
309
+ HIGH: old-blog.startup.io -> CNAME to Ghost.io (expired)
310
+ MEDIUM: mail2.startup.io -> MX points to decommissioned server
311
+ All 4 can be claimed by an attacker. Immediate action required."
312
+ ```
313
+
314
+ ### DNS Tunneling Detection
315
+
316
+ ```
317
+ You: "Analyze these DNS queries for tunneling: [list of suspicious queries]"
318
+
319
+ Agent: -> tunnel_full_scan {queries: [...], timestamps: [...]}
320
+ -> "Tunneling probability: 94/100 (VERY HIGH)
321
+ Entropy: 4.8 bits/char avg (normal is <3.5)
322
+ Query length: 180+ chars avg (normal is <50)
323
+ Tool signature: Matches iodine encoding pattern
324
+ Covert channel: Beaconing detected at 30s intervals
325
+ TXT payloads: Base64-encoded data in responses
326
+ Verdict: Active DNS tunnel, likely iodine-based C2."
327
+ ```
328
+
329
+ ### Typosquatting Detection
330
+
331
+ ```
332
+ You: "Find typosquatting domains targeting mybank.com"
333
+
334
+ Agent: -> typo_full_scan {domain: "mybank.com", check_registered: true}
335
+ -> "Generated 847 typosquat variants across 7 techniques.
336
+ 42 are registered and resolving:
337
+ - myb4nk.com (homoglyph) -> resolves to 185.x.x.x (suspicious)
338
+ - mybank.co (TLD variation) -> parked page
339
+ - my-bank.com (combosquat) -> phishing page detected
340
+ - mybanк.com (IDN/Cyrillic 'к') -> redirect to credential harvester
341
+ HIGH RISK: 4 domains actively serving phishing content.
342
+ Recommend takedown requests for mybanк.com and my-bank.com."
343
+ ```
344
+
345
+ ### Certificate Transparency Monitoring
346
+
347
+ ```
348
+ You: "Monitor certificates issued for our domain in the last 7 days"
349
+
350
+ Agent: -> ct_monitor {domain: "company.com", days: 7}
351
+ -> ct_unauthorized_detect {domain: "company.com"}
352
+ -> ct_expiry_monitor {domain: "company.com", days_threshold: 30}
353
+ -> "Certificate activity for company.com (last 7 days):
354
+ 3 new certificates issued:
355
+ - *.company.com by Let's Encrypt (expected)
356
+ - api.company.com by DigiCert (expected)
357
+ - company.com by GoGetSSL (UNAUTHORIZED — not in CAA)
358
+ Expiring soon: 2 certificates expire within 30 days.
359
+ Action: Investigate the GoGetSSL certificate — your CAA
360
+ record only allows Let's Encrypt and DigiCert."
361
+ ```
362
+
363
+ ---
364
+
365
+ ## Tools Reference (103 tools)
366
+
367
+ ### Category Overview
368
+
369
+ | Category | Tools | Description |
370
+ |----------|-------|-------------|
371
+ | :mag: [DNS Reconnaissance](#-dns-reconnaissance-12) | 12 | Record lookup, zone transfer, cache snooping, NSEC walking, propagation, split-horizon |
372
+ | :shield: [DNSSEC Validation](#-dnssec-validation-8) | 8 | Chain of trust, DS/DNSKEY/RRSIG/NSEC checks, algorithm audit, key rollover |
373
+ | :email: [Email Security](#-email-security-9) | 9 | SPF, DKIM, DMARC, BIMI, MTA-STS, DANE, PTR, spoofability scoring |
374
+ | :warning: [Hijacking & Takeover](#-hijacking--takeover-9) | 9 | Dangling CNAME/NS/MX, delegation chain, DNS rebinding, registrar security, BGP impact |
375
+ | :hole: [DNS Tunneling Detection](#-dns-tunneling-detection-7) | 7 | Entropy analysis, length checks, TXT payloads, tool signatures, covert channels |
376
+ | :lock: [Certificate Transparency](#-certificate-transparency-7) | 7 | CT log search, wildcard audit, unauthorized CA detection, expiry monitoring |
377
+ | :globe_with_meridians: [Domain Intelligence](#-domain-intelligence-10) | 10 | WHOIS/RDAP, domain age, history, DGA detection, reputation, hosting info |
378
+ | :dart: [Typosquatting & Brand Protection](#-typosquatting--brand-protection-8) | 8 | Homoglyph, bitsquat, TLD variation, combosquat, soundsquat, IDN homograph, keyboard proximity |
379
+ | :no_entry: [Blocklist & Reputation](#-blocklist--reputation-6) | 6 | DNSBL/RBL, SURBL, phishing lists, malware lists, fast-flux detection, risk scoring |
380
+ | :gear: [Infrastructure Security](#-infrastructure-security-9) | 9 | Open resolver, amplification, rate limiting, software CVE, EDNS, TCP fallback, DNS cookies |
381
+ | :detective: [DNS Privacy](#-dns-privacy-6) | 6 | DoH, DoT, DoQ testing, ECS leak detection, resolver audit, DNS leak test |
382
+ | :biohazard: [Passive DNS & Threat Intel](#-passive-dns--threat-intel-7) | 7 | Passive DNS, co-hosting, IP-to-domains, malicious feeds, C2 detection, sinkhole check |
383
+ | :page_facing_up: [Compliance & Reporting](#-compliance--reporting-5) | 5 | RFC compliance, CIS benchmarks, full audit, SARIF/Markdown/JSON reports, baseline comparison |
384
+
385
+ ---
386
+
387
+ <details open>
388
+ <summary><h3>:mag: DNS Reconnaissance (12)</h3></summary>
389
+
390
+ | Tool | Description |
391
+ |------|-------------|
392
+ | `dns_lookup` | Resolve all DNS record types for a domain in parallel |
393
+ | `dns_reverse` | Perform PTR (reverse DNS) lookup with Forward Confirmed rDNS (FCrDNS) validation |
394
+ | `dns_zone_transfer` | Attempt AXFR (full zone transfer) against a domain's nameserver via TCP |
395
+ | `dns_subdomain_enum` | Enumerate subdomains using passive CT (Certificate Transparency) log lookups via crt.sh |
396
+ | `dns_cache_snoop` | Perform DNS cache snooping by sending non-recursive query (RD=0) to a nameserver |
397
+ | `dns_nsec_walk` | Attempt DNSSEC NSEC zone walking to enumerate domain names in a signed zone |
398
+ | `dns_wildcard_detect` | Detect wildcard DNS configurations by resolving random non-existent subdomains |
399
+ | `dns_server_fingerprint` | Fingerprint a DNS server by querying CHAOS class TXT records (version.bind) |
400
+ | `dns_recursive_check` | Test whether a nameserver is an open recursive resolver (RD=1 for external domain) |
401
+ | `dns_propagation` | Check DNS propagation by querying 20+ globally distributed public resolvers |
402
+ | `dns_split_horizon` | Detect split-horizon (split-brain) DNS by comparing internal vs external resolver responses |
403
+ | `dns_ttl_analysis` | Analyze DNS TTL values across all record types for a domain |
404
+
405
+ </details>
406
+
407
+ <details>
408
+ <summary><h3>:shield: DNSSEC Validation (8)</h3></summary>
409
+
410
+ | Tool | Description |
411
+ |------|-------------|
412
+ | `dnssec_validate` | Full DNSSEC chain of trust validation from root to TLD to domain |
413
+ | `dnssec_check_ds` | Check DS (Delegation Signer) records for a domain |
414
+ | `dnssec_check_dnskey` | List all DNSKEY records for a domain |
415
+ | `dnssec_check_rrsig` | Check RRSIG (Resource Record Signature) records and expiry |
416
+ | `dnssec_check_nsec` | Check NSEC/NSEC3 records for a domain |
417
+ | `dnssec_algorithm_audit` | Inventory all DNSSEC algorithms used in DS, DNSKEY, and RRSIG records |
418
+ | `dnssec_key_rollover` | Check for DNSSEC key rollover indicators |
419
+ | `dnssec_full_audit` | Comprehensive DNSSEC audit: all 7 checks combined with unified report |
420
+
421
+ </details>
422
+
423
+ <details>
424
+ <summary><h3>:email: Email Security (9)</h3></summary>
425
+
426
+ | Tool | Description |
427
+ |------|-------------|
428
+ | `email_check_spf` | Check SPF (Sender Policy Framework) record with mechanism analysis |
429
+ | `email_check_dkim` | Check DKIM records by probing common selectors (google, selector1, dkim, etc.) |
430
+ | `email_check_dmarc` | Check DMARC record with policy analysis and reporting configuration |
431
+ | `email_check_bimi` | Check BIMI (Brand Indicators for Message Identification) record |
432
+ | `email_check_mta_sts` | Check MTA-STS (Mail Transfer Agent Strict Transport Security) configuration |
433
+ | `email_check_dane` | Check DANE/TLSA records for a domain's MX hosts |
434
+ | `email_check_ptr` | Check PTR and FCrDNS (Forward-Confirmed reverse DNS) for MX hosts |
435
+ | `email_spoofability_score` | Calculate email spoofability score (0-100) based on SPF, DKIM, DMARC |
436
+ | `email_full_audit` | Comprehensive email security audit across all protocols |
437
+
438
+ </details>
439
+
440
+ <details>
441
+ <summary><h3>:warning: Hijacking & Takeover (9)</h3></summary>
442
+
443
+ | Tool | Description |
444
+ |------|-------------|
445
+ | `hijack_dangling_cname` | Detect dangling CNAME records that could allow subdomain takeover |
446
+ | `hijack_dangling_ns` | Detect dangling NS records that could allow full domain takeover |
447
+ | `hijack_dangling_mx` | Detect dangling MX records that could allow email hijacking |
448
+ | `hijack_ns_delegation` | Walk the DNS delegation chain and verify consistency |
449
+ | `hijack_dns_rebinding` | Detect DNS rebinding candidates via IP changes combined with low TTL |
450
+ | `hijack_registrar_security` | Check domain registrar security posture via RDAP |
451
+ | `hijack_change_monitor` | Monitor DNS record changes by comparing against a stored baseline |
452
+ | `hijack_subdomain_takeover` | Full subdomain takeover scan using CT logs and CNAME resolution |
453
+ | `hijack_bgp_impact` | Assess BGP-level impact of domain hijacking via Team Cymru ASN lookup |
454
+
455
+ </details>
456
+
457
+ <details>
458
+ <summary><h3>:hole: DNS Tunneling Detection (7)</h3></summary>
459
+
460
+ | Tool | Description |
461
+ |------|-------------|
462
+ | `tunnel_entropy_analysis` | Calculate Shannon entropy per subdomain label to detect tunneling |
463
+ | `tunnel_query_length` | Measure subdomain label and total query lengths for anomaly detection |
464
+ | `tunnel_txt_payload` | Detect encoded payloads in TXT records: base64, hex, binary markers |
465
+ | `tunnel_record_anomaly` | Analyze queries for record type abuse patterns used in tunneling |
466
+ | `tunnel_tool_signatures` | Match patterns against known tools: iodine, dns2tcp, dnscat2, Cobalt Strike, Sliver C2, DNSStager |
467
+ | `tunnel_covert_channel` | Detect covert channels through beaconing timing analysis and label pattern analysis |
468
+ | `tunnel_full_scan` | All 6 tunnel checks combined with overall probability score (0-100) |
469
+
470
+ </details>
471
+
472
+ <details>
473
+ <summary><h3>:lock: Certificate Transparency (7)</h3></summary>
474
+
475
+ | Tool | Description |
476
+ |------|-------------|
477
+ | `ct_search` | Search CT logs via crt.sh for certificates issued to a domain |
478
+ | `ct_wildcard_audit` | Audit CT logs for wildcard certificates |
479
+ | `ct_unauthorized_detect` | Detect unauthorized certificates by cross-referencing CT logs with CAA records |
480
+ | `ct_monitor` | Monitor CT logs for recently issued certificates within N days |
481
+ | `ct_check_caa` | Check CAA (Certification Authority Authorization) DNS records |
482
+ | `ct_cert_inventory` | Build a full certificate inventory from CT logs |
483
+ | `ct_expiry_monitor` | Find certificates expiring within N days |
484
+
485
+ </details>
486
+
487
+ <details>
488
+ <summary><h3>:globe_with_meridians: Domain Intelligence (10)</h3></summary>
489
+
490
+ | Tool | Description |
491
+ |------|-------------|
492
+ | `domain_whois` | Query RDAP for domain WHOIS information |
493
+ | `domain_age` | Determine domain age via RDAP creation date |
494
+ | `domain_history` | Retrieve domain event history from RDAP |
495
+ | `domain_expiry_risk` | Assess domain expiry risk via RDAP |
496
+ | `domain_parked_detect` | Detect if a domain is a parked/for-sale page |
497
+ | `domain_dga_detect` | Analyze domains for DGA (Domain Generation Algorithm) characteristics |
498
+ | `domain_newly_registered` | Search CT logs for recently issued certs to discover new domains |
499
+ | `domain_reputation` | Multi-source domain reputation check |
500
+ | `domain_hosting_info` | Get hosting infrastructure details for a domain |
501
+ | `domain_related` | Find related domains through shared NS, MX, IP, and CT co-occurrence |
502
+
503
+ </details>
504
+
505
+ <details>
506
+ <summary><h3>:dart: Typosquatting & Brand Protection (8)</h3></summary>
507
+
508
+ | Tool | Description |
509
+ |------|-------------|
510
+ | `typo_homoglyph` | Generate visually similar domain variants (o/0, l/1, rn/m, Cyrillic lookalikes) |
511
+ | `typo_bitsquat` | Generate all single-bit-flip variants of each character in the domain |
512
+ | `typo_tld_variation` | Test common TLD confusions (.com/.co/.cm/.om/.net, etc.) |
513
+ | `typo_combosquat` | Generate brand+keyword combinations (login-, secure-, my-, -app, etc.) |
514
+ | `typo_soundsquat` | Generate phonetically similar variants using sound substitutions |
515
+ | `typo_idn_homograph` | Generate IDN homograph variants using Cyrillic, Greek, Armenian characters |
516
+ | `typo_keyboard_proximity` | Generate QWERTY keyboard proximity typos: adjacent keys, omissions, doubles, swaps |
517
+ | `typo_full_scan` | All 7 typosquatting techniques combined with optional registration check |
518
+
519
+ </details>
520
+
521
+ <details>
522
+ <summary><h3>:no_entry: Blocklist & Reputation (6)</h3></summary>
523
+
524
+ | Tool | Description |
525
+ |------|-------------|
526
+ | `bl_check_dnsbl` | Check an IP against multiple DNS-based blocklists (DNSBL/RBL) |
527
+ | `bl_check_surbl` | Check a domain against domain-based blocklists (SURBL, Spamhaus DBL, URIBL) |
528
+ | `bl_check_phishing` | Check domain for phishing indicators via blocklists and domain age |
529
+ | `bl_check_malware` | Check domain against malware-specific blocklists (abuse.ch, etc.) |
530
+ | `bl_fast_flux_detect` | Detect fast-flux DNS behavior via multiple timed resolutions |
531
+ | `bl_domain_score` | Aggregated domain risk score (0-100) from DNSBL, age, DNSSEC, SPF/DMARC |
532
+
533
+ </details>
534
+
535
+ <details>
536
+ <summary><h3>:gear: Infrastructure Security (9)</h3></summary>
537
+
538
+ | Tool | Description |
539
+ |------|-------------|
540
+ | `infra_open_resolver` | Test if a nameserver is an open resolver accepting external recursive queries |
541
+ | `infra_amplification` | Measure DNS amplification factor of a nameserver |
542
+ | `infra_rate_limiting` | Test Response Rate Limiting (RRL) on a nameserver |
543
+ | `infra_software_cve` | Fingerprint DNS server software via CHAOS version.bind |
544
+ | `infra_edns_compliance` | Test EDNS0 compliance of a nameserver |
545
+ | `infra_tcp_fallback` | Test TCP fallback support for large responses |
546
+ | `infra_dns_cookie` | Test DNS Cookie support (RFC 7873) |
547
+ | `infra_axfr_protection` | Test zone transfer (AXFR) protection |
548
+ | `infra_ns_diversity` | Analyze nameserver diversity (count, ASN distribution, /24 subnets) |
549
+
550
+ </details>
551
+
552
+ <details>
553
+ <summary><h3>:detective: DNS Privacy (6)</h3></summary>
554
+
555
+ | Tool | Description |
556
+ |------|-------------|
557
+ | `privacy_doh_test` | Test DNS-over-HTTPS (DoH) endpoint connectivity and response |
558
+ | `privacy_dot_test` | Test DNS-over-TLS (DoT) endpoint connectivity and security |
559
+ | `privacy_doq_test` | Test DNS-over-QUIC (DoQ) support |
560
+ | `privacy_ecs_leak` | Test EDNS Client Subnet (ECS) leak on a resolver |
561
+ | `privacy_resolver_audit` | Comprehensive privacy audit of a DNS resolver |
562
+ | `privacy_leak_test` | DNS leak test: determine which resolver(s) your system actually uses |
563
+
564
+ </details>
565
+
566
+ <details>
567
+ <summary><h3>:biohazard: Passive DNS & Threat Intel (7)</h3></summary>
568
+
569
+ | Tool | Description |
570
+ |------|-------------|
571
+ | `threat_passive_dns` | Query passive DNS data for a domain |
572
+ | `threat_cohosting` | Analyze domain co-hosting via reverse DNS and CT logs |
573
+ | `threat_ip_to_domains` | Resolve IP to all known domains via PTR records and CT log searches |
574
+ | `threat_malicious_feed` | Check domain against free threat intelligence feeds (Spamhaus, SURBL, URLhaus) |
575
+ | `threat_c2_detect` | Analyze domains for C2 indicators: DGA score, fast-flux, low TTL, DNSBL |
576
+ | `threat_actor_infra` | Map domain infrastructure: NS, MX, IP, ASN (Team Cymru), registrar (RDAP) |
577
+ | `threat_sinkhole_check` | Check if a domain resolves to known sinkhole operators (Microsoft, Shadowserver, abuse.ch) |
578
+
579
+ </details>
580
+
581
+ <details>
582
+ <summary><h3>:page_facing_up: Compliance & Reporting (5)</h3></summary>
583
+
584
+ | Tool | Description |
585
+ |------|-------------|
586
+ | `report_rfc_compliance` | Test compliance with RFC 1035, 4034, 6891, 7208, 7489 |
587
+ | `report_best_practice` | CIS DNS Benchmark-style checks: DNSSEC, email auth, NS diversity, zone transfer, version hiding |
588
+ | `report_full_audit` | Comprehensive audit across all categories with severity ratings |
589
+ | `report_generate` | Full audit with output in JSON, Markdown, or SARIF format |
590
+ | `report_compare` | Compare current audit against a previous baseline to detect drift |
591
+
592
+ </details>
593
+
594
+ ---
595
+
596
+ ## Configuration
597
+
598
+ ### Environment Variables
599
+
600
+ All environment variables are **optional**. Core functionality (103 tools) works entirely via local DNS queries with zero external API calls.
601
+
602
+ ```bash
603
+ # Optional: Custom DNS resolver (default: system resolver)
604
+ export DNS_RESOLVER=8.8.8.8
605
+
606
+ # Optional: SecurityTrails API for enriched passive DNS data
607
+ export SECURITYTRAILS_API_KEY=your-key
608
+
609
+ # Optional: VirusTotal API for domain reputation enrichment
610
+ export VIRUSTOTAL_API_KEY=your-key
611
+
612
+ # Optional: Google Safe Browsing API for phishing/malware URL checks
613
+ export SAFEBROWSING_API_KEY=your-key
614
+ ```
615
+
616
+ | Variable | Required | What it enables |
617
+ |----------|----------|----------------|
618
+ | `DNS_RESOLVER` | No | Override the system DNS resolver for all queries |
619
+ | `SECURITYTRAILS_API_KEY` | No | Enriched passive DNS and domain intelligence data |
620
+ | `VIRUSTOTAL_API_KEY` | No | Domain reputation scoring via VirusTotal |
621
+ | `SAFEBROWSING_API_KEY` | No | Google Safe Browsing checks for phishing/malware domains |
622
+
623
+ **Without any API keys**, all 103 tools function using local DNS queries, public DNS resolvers, RDAP, crt.sh (Certificate Transparency), and DNS-based blocklists. API keys only add optional enrichment from third-party threat intelligence services.
624
+
625
+ ---
626
+
627
+ ## CLI Usage
628
+
629
+ ```bash
630
+ # Show help
631
+ npx dns-security-mcp --help
632
+
633
+ # List all 103 tools with descriptions
634
+ npx dns-security-mcp --list
635
+
636
+ # Run any tool directly from the command line
637
+ npx dns-security-mcp --tool dns_lookup '{"domain":"example.com","types":["A","AAAA","MX","TXT"]}'
638
+ npx dns-security-mcp --tool dnssec_validate '{"domain":"cloudflare.com"}'
639
+ npx dns-security-mcp --tool email_spoofability_score '{"domain":"google.com"}'
640
+ npx dns-security-mcp --tool hijack_subdomain_takeover '{"domain":"target.com","use_ct":true}'
641
+ npx dns-security-mcp --tool tunnel_full_scan '{"queries":["aGVsbG8.tunnel.evil.com","d29ybGQ.tunnel.evil.com"]}'
642
+ npx dns-security-mcp --tool typo_full_scan '{"domain":"mybank.com","check_registered":true}'
643
+ npx dns-security-mcp --tool report_generate '{"domain":"example.com","format":"sarif"}'
644
+
645
+ # Using Bun (faster startup)
646
+ bunx dns-security-mcp --tool bl_domain_score '{"domain":"suspicious-site.xyz"}'
647
+
648
+ # With custom DNS resolver
649
+ DNS_RESOLVER=1.1.1.1 npx dns-security-mcp --tool dns_propagation '{"domain":"example.com"}'
650
+ ```
651
+
652
+ ---
653
+
654
+ ## Architecture
655
+
656
+ ```
657
+ src/
658
+ index.ts # CLI entrypoint (--help, --list, --tool, stdio server)
659
+ protocol/
660
+ mcp-server.ts # MCP server setup (stdio transport)
661
+ tools.ts # Tool registry — all 103 tools assembled here
662
+ types/
663
+ index.ts # Shared types (ToolDef, ToolContext, ToolResult)
664
+ utils/
665
+ dns-client.ts # Shared DNS query client (UDP/TCP, dns-packet)
666
+ rate-limiter.ts # Per-provider rate limiter
667
+ cache.ts # TTL cache for DNS responses
668
+ dns/ # DNS Reconnaissance tools (12)
669
+ dnssec/ # DNSSEC Validation tools (8)
670
+ email/ # Email Security tools (9)
671
+ hijack/ # Hijacking & Takeover tools (9)
672
+ tunnel/ # DNS Tunneling Detection tools (7)
673
+ ct/ # Certificate Transparency tools (7)
674
+ domain/ # Domain Intelligence tools (10)
675
+ typo/ # Typosquatting & Brand Protection tools (8)
676
+ blocklist/ # Blocklist & Reputation tools (6)
677
+ infra/ # Infrastructure Security tools (9)
678
+ privacy/ # DNS Privacy tools (6)
679
+ threat/ # Passive DNS & Threat Intel tools (7)
680
+ report/ # Compliance & Reporting tools (5)
681
+ data/ # Static data (DKIM selectors, DNSBL lists, tool signatures)
682
+ ```
683
+
684
+ **Design decisions:**
685
+
686
+ - **3 dependencies, nothing else** &mdash; `@modelcontextprotocol/sdk` for the MCP protocol, `zod` for input validation, `dns-packet` for raw DNS packet crafting. No bloated dependency tree. No native modules. No C bindings.
687
+ - **100% local core** &mdash; Every tool works via direct DNS queries using `dgram` (UDP) and `net` (TCP) sockets with `dns-packet` for wire-format encoding/decoding. No external API calls required for any core functionality.
688
+ - **13 providers, 1 server** &mdash; Each security category is an independent module. The AI agent picks which tools to use based on the investigation context.
689
+ - **Raw DNS access** &mdash; Unlike tools built on `dns.resolve()`, dns-security-mcp crafts raw DNS packets. This enables DNSSEC record queries (DS, DNSKEY, RRSIG, NSEC), CHAOS class queries (version.bind), non-recursive queries (cache snooping), AXFR attempts (zone transfer), and EDNS options &mdash; none of which are possible with Node's built-in DNS module.
690
+ - **TTL caching** &mdash; DNS responses are cached respecting record TTL values. CT log queries cached for 15 minutes. RDAP responses cached for 10 minutes. Prevents redundant queries during multi-tool workflows.
691
+ - **Graceful degradation** &mdash; Missing API keys never crash the server. Optional enrichment tools return clear messages: "Set SECURITYTRAILS_API_KEY for enriched passive DNS data."
692
+ - **Multiple output formats** &mdash; Reports can be generated as JSON (machine-readable), Markdown (human-readable), or SARIF (IDE/CI integration).
693
+
694
+ ---
695
+
696
+ ## Part of the MCP Security Suite
697
+
698
+ | Project | Domain | Tools |
699
+ |---|---|---|
700
+ | [hackbrowser-mcp](https://github.com/badchars/hackbrowser-mcp) | Browser-based security testing | 39 tools |
701
+ | [cloud-audit-mcp](https://github.com/badchars/cloud-audit-mcp) | Cloud security (AWS/Azure/GCP) | 38 tools |
702
+ | [github-security-mcp](https://github.com/badchars/github-security-mcp) | GitHub security posture | 39 tools |
703
+ | [cve-mcp](https://github.com/badchars/cve-mcp) | Vulnerability intelligence | 23 tools |
704
+ | [osint-mcp-server](https://github.com/badchars/osint-mcp-server) | OSINT & reconnaissance | 37 tools |
705
+ | [darknet-mcp-server](https://github.com/badchars/darknet-mcp-server) | Dark web & threat intelligence | 66 tools |
706
+ | **dns-security-mcp** | **DNS security intelligence** | **103 tools** |
707
+
708
+ ---
709
+
710
+ ## Contributing
711
+
712
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
713
+
714
+ ---
715
+
716
+ <p align="center">
717
+ <b>For authorized security testing and assessment only.</b><br>
718
+ Always ensure you have proper authorization before performing DNS security testing on any target.
719
+ </p>
720
+
721
+ <p align="center">
722
+ <a href="LICENSE">MIT License</a> &bull; Built by <a href="https://github.com/orhanyildirim">Orhan Yildirim</a> &bull; TypeScript + Bun
723
+ </p>