Zum Inhalt springen
Skillpedia
Analyse & Tabellen35k · #7824

detecting-dns-exfiltration-with-dns-query-analysis

Was er macht

Dieses Tool analysiert DNS-Datenverkehr, um Versuche von Datendiebstahl aufzuspüren. Es sucht nach ungewöhnlichen Mustern, wie Daten über DNS-Anfragen und -Antworten verschickt werden, was auf den Einsatz schädlicher Tools hindeuten kann.

Wann du ihn nutzt

  • ✓Wenn du einen möglichen Datenabfluss über das Netzwerk untersuchst.
  • ✓Wenn du die Netzwerksicherheit auf verdächtige Aktivitäten überwachst.
  • ✓Wenn du verstehen willst, wie Angriffstools DNS nutzen.

Link zum Skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-dns-exfiltration-with-dns-query-analysis/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-dns-exfiltration-with-dns-query-analysis/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Suche nach auffälligen Aktivitäten im DNS-Datenverkehr, die auf einen Datenabfluss hindeuten könnten.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Das Tool untersucht Merkmale von DNS-Anfragen, etwa die Länge der Subdomains, die Anzahl der Anfragen an dieselbe Domain und die verwendeten DNS-Record-Typen. Diese vergleicht es mit normalen Mustern, um Auffälligkeiten zu erkennen.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Detecting DNS Exfiltration with DNS Query Analysis

Overview

DNS exfiltration exploits the Domain Name System as a covert channel to extract data from compromised networks. Attackers encode stolen data into DNS query names (subdomains) or DNS response records (TXT, CNAME, NULL), bypassing traditional security controls that typically allow DNS traffic unrestricted. Tools like iodine, dnscat2, and dns2tcp enable full TCP tunneling over DNS. Detection requires analyzing DNS query patterns for anomalies including excessive query length, high entropy subdomain strings, abnormal query volumes to single domains, and oversized TXT record responses. This skill covers building a comprehensive DNS exfiltration detection capability using passive DNS analysis, statistical methods, and machine learning approaches.

When to Use

  • When investigating security incidents that require detecting dns exfiltration with dns query analysis
  • When building detection rules or threat hunting queries for this domain
  • When SOC analysts need structured procedures for this analysis type
  • When validating security monitoring coverage for related attack techniques

Prerequisites

  • Access to DNS query logs (passive DNS capture, DNS server logs, or PCAP)
  • Zeek, Suricata, or tcpdump for DNS traffic capture
  • Python 3.8+ with scipy, numpy, pandas, and scikit-learn
  • SIEM platform for alert correlation
  • Baseline of normal DNS traffic patterns for the environment

Core Concepts

DNS Tunneling Mechanics

DNS exfiltration encodes data in different parts of DNS messages:

Outbound (Query-based exfiltration):

Encoded data as subdomain labels:
dGhlIHNlY3JldCBkYXRh.exfil.attacker.com
[base64-encoded data].[tunnel domain]

Query types used: A, AAAA, CNAME, MX, TXT, NULL

Inbound (Response-based command channel):

TXT records carry encoded commands/data in responses
CNAME records chain encoded data through multiple labels
NULL records carry arbitrary binary data

Detection Indicators

Indicator Normal DNS DNS Tunneling
Subdomain length 5-20 chars 40-253 chars
Label count 2-4 labels 5-10+ labels
Shannon entropy 2.5-3.5 bits 4.0-5.5 bits
Query volume (per domain) Variable 100s-1000s/min
TXT response size < 100 bytes 200-4000+ bytes
Unique subdomains Low Very high
Query type distribution Mostly A/AAAA Heavy TXT, NULL, CNAME

Common Tunneling Tools

Tool Protocol Encoding Detection Difficulty
iodine IP-over-DNS Base32/Base64/Raw Medium
dnscat2 TCP-over-DNS Hex encoding Medium
dns2tcp TCP-over-DNS Base64 Medium
DNSExfiltrator Custom Base64 Low
Cobalt Strike DNS C2 over DNS Custom encoding High

Workflow

Step 1: Capture DNS Traffic

Using Zeek:

# Live capture
zeek -i eth0 -C base/protocols/dns

# Offline PCAP analysis
zeek -r traffic.pcap base/protocols/dns

# Output: dns.log with query, qtype, answers, TTL

Using tcpdump:

# Capture all DNS traffic
tcpdump -i eth0 -w dns_capture.pcap port 53

# Capture with size filter (large DNS packets)
tcpdump -i eth0 -w large_dns.pcap 'port 53 and greater 512'

Using Suricata:

# In suricata.yaml, enable DNS logging
outputs:
  - eve-log:
      types:
        - dns:
            query: yes
            answer: yes
            formats: [detailed]

Step 2: Analyze Query Characteristics

Python script for DNS exfiltration detection:

#!/usr/bin/env python3
"""DNS Exfiltration Detector - Analyzes DNS logs for tunneling indicators."""

import json
import math
import re
import sys
from collections import defaultdict
from datetime import datetime, timedelta

import pandas as pd


def calculate_entropy(domain: str) -> float:
    """Calculate Shannon entropy of a string."""
    if not domain:
        return 0.0
    freq = defaultdict(int)
    for char in domain:
        freq[char] += 1
    length = len(domain)
    entropy = -sum(
        (count / length) * math.log2(count / length)
        for count in freq.values()
    )
    return entropy


def extract_subdomain(query: str) -> str:
    """Extract subdomain portion from FQDN."""
    parts = query.rstrip('.').split('.')
    if len(parts) > 2:
        return '.'.join(parts[:-2])
    return ''


def get_base_domain(query: str) -> str:

…
Häufige Fragen

Was ist DNS-Datenexfiltration?

Dabei verstecken Angreifer gestohlene Daten in DNS-Anfragen oder -Antworten, um sie aus dem Netzwerk zu schleusen, ohne von Firewalls blockiert zu werden.

Welche Tools nutzen diese Methode?

Bekannte Tools sind iodine, dnscat2 und dns2tcp. Sie erstellen Tunnel, um Daten über DNS zu übertragen.

Was sind „TXT/CNAME/NULL-Records“?

Das sind DNS-Record-Typen, die sich zum Transport von Daten eignen. Angreifer können sie missbrauchen, um Informationen zu senden oder zu empfangen.

Details

Originalbeschreibung des Autors

Detect data exfiltration via DNS tunneling (tools like iodine, dnscat2, dns2tcp) by analyzing query entropy, subdomain length, query volume to single domains, TXT/CNAME/NULL record abuse, and oversized response payloads using passive DNS monitoring and statistical/ML methods. Use when hunting for covert DNS-based data exfiltration or building a passive DNS anomaly detection capability.

repo: mukul975/Anthropic-Cybersecurity-Skills

Beliebtheit

GitHub-Sterne
35k
Platz im Ranking
#7824
Lizenz
Apache-2.0
Aktualisiert
31.8.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills