본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트35k · #7824

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

하는 일

이 도구는 DNS 트래픽을 분석해 데이터 도난 시도를 찾습니다. DNS 조회와 응답을 통해 데이터가 전송되는 특이한 패턴을 찾으며, 이는 악성 도구가 사용되고 있음을 나타낼 수 있습니다.

사용하는 경우

  • ✓네트워크를 통한 잠재적 데이터 유출을 조사할 때.
  • ✓의심스러운 활동을 찾기 위해 네트워크 보안을 모니터링할 때.
  • ✓공격 도구가 DNS를 어떻게 사용하는지 이해하려는 경우.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-dns-exfiltration-with-dns-query-analysis/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“데이터 도난을 나타낼 수 있는 DNS 트래픽의 이상 활동을 찾아 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 DNS 조회의 특징을 검사합니다. 예를 들어 하위 도메인의 길이, 같은 도메인에 대한 조회 횟수, 사용된 DNS 레코드 유형 등을 봅니다. 이 특징을 정상 패턴과 비교해 이상을 찾습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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:

…
자주 묻는 질문

DNS 데이터 유출(exfiltration)이란 무엇인가요?

공격자가 DNS 조회나 응답 안에 훔친 데이터를 숨겨, 방화벽을 우회해 네트워크 밖으로 보내는 기법입니다.

이 기법을 사용하는 도구는 무엇인가요?

iodine, dnscat2, dns2tcp 같은 도구가 흔히 쓰이며, 이들은 DNS를 통해 데이터를 주고받는 터널을 만듭니다.

'TXT/CNAME/NULL 레코드'란 무엇인가요?

데이터를 실을 수 있는 DNS 레코드 유형입니다. 공격은 이 레코드를 악용해 정보를 보내거나 받을 수 있습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
35k
순위
#7824
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬