Install
$ agentstack add skill-killvxk-cybersecurity-skills-zh-analyzing-network-covert-channels-in-malware ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
分析恶意软件中的网络隐蔽信道
概述
恶意软件使用隐蔽信道将 C2 通信和数据泄露伪装成看似合法的网络流量。DNS 隧道将数据编码在 DNS 查询和响应中(iodine、dnscat2 等工具和 FrameworkPOS 等恶意软件家族均使用此技术)。ICMP 隧道将数据隐藏在回显请求/响应载荷中(icmpsh、ptunnel)。HTTP 隐蔽信道将 C2 数据嵌入头部、Cookie 或隐写图像中。协议滥用利用允许的协议绕过防火墙。现代基于机器学习的方法对 DNS 隧道检测可达 99% 以上的召回率,但低吞吐量泄露仍然具有挑战性。Palo Alto Unit42 在 2024 年跟踪了三个主要的 DNS 隧道活动(TrkCdn、SecShow、Savvy Seahorse),显示了该技术的持续普遍性。
前置条件
- Python 3.9+,安装
scapy、dpkt、dnslib - Wireshark/tshark,用于 PCAP 分析
- Zeek(原 Bro),用于网络监控
- DNS 查询日志基础设施
- 对 DNS、ICMP、HTTP 协议的数据包级理解
操作步骤
步骤 1:DNS 隧道检测
#!/usr/bin/env python3
"""检测网络流量中的 DNS 隧道和隐蔽信道。"""
import sys
import json
import math
from collections import Counter, defaultdict
try:
from scapy.all import rdpcap, DNS, DNSQR, DNSRR, IP, ICMP
except ImportError:
print("pip install scapy")
sys.exit(1)
def entropy(data):
if not data:
return 0
freq = Counter(data)
length = len(data)
return -sum((c/length) * math.log2(c/length) for c in freq.values())
def analyze_dns_tunneling(pcap_path):
"""检测 PCAP 中的 DNS 隧道指标。"""
packets = rdpcap(pcap_path)
domain_stats = defaultdict(lambda: {
"queries": 0, "total_qname_len": 0, "subdomain_lengths": [],
"query_types": Counter(), "unique_subdomains": set(),
})
for pkt in packets:
if pkt.haslayer(DNS) and pkt.haslayer(DNSQR):
qname = pkt[DNSQR].qname.decode('utf-8', errors='replace').rstrip('.')
qtype = pkt[DNSQR].qtype
parts = qname.split('.')
if len(parts) >= 3:
base_domain = '.'.join(parts[-2:])
subdomain = '.'.join(parts[:-2])
stats = domain_stats[base_domain]
stats["queries"] += 1
stats["total_qname_len"] += len(qname)
stats["subdomain_lengths"].append(len(subdomain))
stats["query_types"][qtype] += 1
stats["unique_subdomains"].add(subdomain)
# 对域名进行隧道指标评分
suspicious = []
for domain, stats in domain_stats.items():
if stats["queries"] 30:
score += 30
reasons.append(f"子域名过长(平均 {avg_subdomain_len:.0f} 字符)")
if unique_ratio > 0.9:
score += 25
reasons.append(f"唯一性高({unique_ratio:.2%})")
if sub_entropy > 4.0:
score += 25
reasons.append(f"熵值高({sub_entropy:.2f})")
if stats["query_types"].get(16, 0) > 10: # TXT 记录
score += 20
reasons.append(f"大量 TXT 查询({stats['query_types'][16]} 次)")
if score >= 50:
suspicious.append({
"domain": domain,
"score": score,
"queries": stats["queries"],
"avg_subdomain_length": round(avg_subdomain_len, 1),
"unique_subdomains": len(stats["unique_subdomains"]),
"subdomain_entropy": round(sub_entropy, 2),
"reasons": reasons,
})
return sorted(suspicious, key=lambda x: -x["score"])
def analyze_icmp_tunneling(pcap_path):
"""检测 PCAP 中的 ICMP 隧道。"""
packets = rdpcap(pcap_path)
icmp_stats = defaultdict(lambda: {"count": 0, "payload_sizes": [], "payloads": []})
for pkt in packets:
if pkt.haslayer(ICMP) and pkt.haslayer(IP):
src = pkt[IP].src
dst = pkt[IP].dst
key = f"{src}->{dst}"
payload = bytes(pkt[ICMP].payload)
icmp_stats[key]["count"] += 1
icmp_stats[key]["payload_sizes"].append(len(payload))
if len(payload) > 64:
icmp_stats[key]["payloads"].append(payload[:100])
suspicious = []
for flow, stats in icmp_stats.items():
if stats["count"] 64 or stats["count"] > 100:
suspicious.append({
"flow": flow,
"packets": stats["count"],
"avg_payload_size": round(avg_size, 1),
"reason": "大型/频繁的 ICMP 载荷表明存在隧道",
})
return suspicious
if __name__ == "__main__":
if len(sys.argv) ")
sys.exit(1)
print("[+] DNS 隧道分析")
dns_results = analyze_dns_tunneling(sys.argv[1])
for r in dns_results:
print(f" {r['domain']}(评分:{r['score']})")
for reason in r['reasons']:
print(f" - {reason}")
print("\n[+] ICMP 隧道分析")
icmp_results = analyze_icmp_tunneling(sys.argv[1])
for r in icmp_results:
print(f" {r['flow']}:{r['reason']}")
验证标准
- 通过熵值、子域名长度和查询量分析检测 DNS 隧道
- 通过载荷大小异常识别 ICMP 隐蔽信道
- 区分隧道域名和合法的 CDN/云流量
- 从捕获的流量中估算数据泄露量
- 提取 C2 通信模式和信标间隔
参考资料
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: killvxk
- Source: killvxk/cybersecurity-skills-zh
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.