
Analyzing Network Covert Channels In Malware
- 300 installs
- 27.3k repo stars
- Updated August 2, 2026
- mukul975/anthropic-cybersecurity-skills
Analyzing Network Covert Channels in Malware is an agent skill that turns covert-channel malware analysis into a structured report with findings, IOCs, and recommendations.
About
Analyzing Network Covert Channels in Malware is an agent skill for solo and indie security-minded builders who need a consistent written artifact after digging into suspicious binaries or traffic. The packaged SKILL content centers on a formal Analysis Report Template: you capture sample identifiers, document findings with severity, extract indicators of compromise in tabular form, and list prioritized recommendations—matching how small teams share limited-access (TLP:AMBER) research without ad-hoc chat logs. Use it when your agent has already performed or summarized technical analysis of covert C2 patterns (DNS tunneling, protocol steganography, timing channels) and you want the output normalized for reviewers, clients, or your own incident notes. It does not replace disassemblers, sandboxes, or PCAP tools; it standardizes the narrative layer so Ship-phase security reviews stay comparable across engagements. Confidence is moderate because the ingested readme emphasizes the template scaffold rather than step-by-step detection recipes—pair with your lab toolchain and human judgment on attribution and disclosure.
- TLP:AMBER-styled analysis report template with sample metadata table (SHA-256, file type, analyst, date)
- Findings matrix with Severity and Details columns for structured triage
- Dedicated IOC extraction table (Type, Value, Context) for threat-intel handoff
- Numbered recommendations section for post-analysis action items
- Apache 2.0 licensed skill package from anthropic-cybersecurity-skills collection
Analyzing Network Covert Channels In Malware by the numbers
- 300 all-time installs (skills.sh)
- +17 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #637 of 2,203 Security skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-network-covert-channels-in-malwareAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 300 |
|---|---|
| repo stars | ★ 27.3k |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 2, 2026 |
| Repository | mukul975/anthropic-cybersecurity-skills ↗ |
What it does
Structure malware reverse-engineering notes on network covert channels into a TLP-style analysis report with findings, IOCs, and remediation steps.
Who is it for?
Developers or one-person security consultancies documenting malware covert-channel analysis after lab or sandbox work.
Skip if: Skip if you need automated PCAP parsing, YARA generation, or full MITRE ATT&CK mapping without supplying your own analysis content—the skill is primarily a reporting scaffold.
When should I use this skill?
After completing or summarizing technical analysis of network covert channels in malware and you need a standardized security report.
What you get
You get a filled Analysis Report Template with severity-ranked findings, extracted IOCs, and numbered recommendations ready for review or incident follow-up.
- Completed Analysis Report Template with findings and IOC tables
- Prioritized recommendations list for remediation or further hunting
By the numbers
- Report template includes 3 numbered recommendation slots
- Three core tables: Sample Information, Findings (severity), IOCs Extracted
Files
Analyzing Network Covert Channels in Malware
Overview
Malware uses covert channels to disguise C2 communication and data exfiltration within legitimate-looking network traffic. DNS tunneling encodes data in DNS queries and responses (used by tools like iodine, dnscat2, and malware families like FrameworkPOS). ICMP tunneling hides data in echo request/reply payloads (icmpsh, ptunnel). HTTP covert channels embed C2 data in headers, cookies, or steganographic images. Protocol abuse exploits allowed protocols to bypass firewalls. DNS tunneling detection achieves 99%+ recall with modern ML-based approaches, though low-throughput exfiltration remains challenging. Palo Alto Unit42 tracked three major DNS tunneling campaigns (TrkCdn, SecShow, Savvy Seahorse) through 2024, showing the technique's continued prevalence.
When to Use
- When investigating security incidents that require analyzing network covert channels in malware
- 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
- Python 3.9+ with
scapy,dpkt,dnslib - Wireshark/tshark for PCAP analysis
- Zeek (formerly Bro) for network monitoring
- DNS query logging infrastructure
- Understanding of DNS, ICMP, HTTP protocols at packet level
Workflow
Step 1: DNS Tunneling Detection
#!/usr/bin/env python3
"""Detect DNS tunneling and covert channels in network traffic."""
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):
"""Detect DNS tunneling indicators in PCAP."""
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)
# Score domains for tunneling indicators
suspicious = []
for domain, stats in domain_stats.items():
if stats["queries"] < 5:
continue
avg_subdomain_len = (sum(stats["subdomain_lengths"]) /
len(stats["subdomain_lengths"]))
unique_ratio = len(stats["unique_subdomains"]) / stats["queries"]
# Calculate subdomain entropy
all_subdomains = ''.join(stats["unique_subdomains"])
sub_entropy = entropy(all_subdomains)
score = 0
reasons = []
if avg_subdomain_len > 30:
score += 30
reasons.append(f"Long subdomains (avg {avg_subdomain_len:.0f} chars)")
if unique_ratio > 0.9:
score += 25
reasons.append(f"High uniqueness ({unique_ratio:.2%})")
if sub_entropy > 4.0:
score += 25
reasons.append(f"High entropy ({sub_entropy:.2f})")
if stats["query_types"].get(16, 0) > 10: # TXT records
score += 20
reasons.append(f"Many TXT queries ({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):
"""Detect ICMP tunneling in PCAP."""
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"] < 5:
continue
avg_size = sum(stats["payload_sizes"]) / len(stats["payload_sizes"])
if avg_size > 64 or stats["count"] > 100:
suspicious.append({
"flow": flow,
"packets": stats["count"],
"avg_payload_size": round(avg_size, 1),
"reason": "Large/frequent ICMP payloads suggest tunneling",
})
return suspicious
if __name__ == "__main__":
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <pcap_file>")
sys.exit(1)
print("[+] DNS Tunneling Analysis")
dns_results = analyze_dns_tunneling(sys.argv[1])
for r in dns_results:
print(f" {r['domain']} (score: {r['score']})")
for reason in r['reasons']:
print(f" - {reason}")
print("\n[+] ICMP Tunneling Analysis")
icmp_results = analyze_icmp_tunneling(sys.argv[1])
for r in icmp_results:
print(f" {r['flow']}: {r['reason']}")Validation Criteria
- DNS tunneling detected via entropy, subdomain length, and query volume analysis
- ICMP covert channels identified through payload size anomalies
- Tunneling domains distinguished from legitimate CDN/cloud traffic
- Data exfiltration volume estimated from captured traffic
- C2 communication patterns and beaconing intervals extracted
References
Analysis Report Template - analyzing-network-covert-channels-in-malware
Sample Information
| Field | Value |
|---|---|
| SHA-256 | |
| File Type | |
| Analysis Date | |
| Analyst | |
| Classification | TLP:AMBER |
Findings
| Finding | Severity | Details |
|---|---|---|
IOCs Extracted
| Type | Value | Context |
|---|---|---|
Recommendations
1. 2. 3.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to the Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by the Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding any notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. Please do not remove or change
the license header comment from a contributed file except when
necessary.
Copyright 2026 mukul975
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
API Reference: Network Covert Channel Detection
Scapy - Packet Analysis
DNS Tunneling Detection
from scapy.all import rdpcap, DNS, DNSQR, IP
packets = rdpcap("capture.pcap")
for pkt in packets:
if pkt.haslayer(DNSQR):
qname = pkt[DNSQR].qname.decode().rstrip(".")
src = pkt[IP].src
qtype = pkt[DNSQR].qtype # 1=A, 16=TXT, 28=AAAAICMP Payload Extraction
from scapy.all import ICMP, Raw
for pkt in packets:
if pkt.haslayer(ICMP) and pkt.haslayer(Raw):
payload = bytes(pkt[Raw].load)
icmp_type = pkt[ICMP].type # 8=echo-request, 0=echo-replyZeek - Covert Channel Detection
DNS Tunneling Indicators
@load base/protocols/dns
event dns_request(c: connection, msg: dns_msg, query: string, qtype: count) {
if (|query| > 60)
print fmt("Long DNS query: %s from %s", query, c$id$orig_h);
}Configuration
zeek -r capture.pcap local
# Outputs: dns.log, conn.log, weird.logtshark - Protocol Filtering
DNS Analysis
tshark -r capture.pcap -Y "dns" -T fields \
-e ip.src -e dns.qry.name -e dns.qry.type -e frame.len
# Filter long DNS queries
tshark -r capture.pcap -Y "dns.qry.name matches \"^.{60,}\"" -T fields -e dns.qry.nameICMP Payload Analysis
tshark -r capture.pcap -Y "icmp && data.len > 64" -T fields \
-e ip.src -e ip.dst -e icmp.type -e data.len -e data.dataDNS Tunneling Tools
| Tool | Technique | Detection Method |
|---|---|---|
| iodine | TXT/NULL/CNAME records | High entropy subdomains |
| dns2tcp | TXT records | Encoded query names |
| dnscat2 | TXT/CNAME/MX/A records | Base32/Base64 subdomain patterns |
| DNSExfiltrator | TXT records | High query volume to single domain |
Entropy Thresholds
| Range | Interpretation |
|---|---|
| < 2.0 | Normal domain labels (English words) |
| 2.0-3.5 | Possibly encoded but may be legitimate |
| 3.5-5.0 | Likely Base32/Base64 encoded (tunneling) |
| > 5.0 | Encrypted/random data (strong tunneling indicator) |
Covert Channel Categories
| Channel Type | Protocol | Detection Method |
|---|---|---|
| DNS Tunneling | DNS (53/udp) | Subdomain entropy, query volume |
| ICMP Tunnel | ICMP (type 8/0) | Payload size, entropy, volume |
| HTTP Header | HTTP (80/tcp) | Cookie size, custom header entropy |
| Protocol Abuse | IP options, GRE | Unusual protocol numbers |
| Timing Channel | TCP | Inter-packet timing analysis |
Standards Reference - analyzing-network-covert-channels-in-malware
Applicable Standards
- MITRE ATT&CK Framework
- NIST SP 800-83 Guide to Malware Incident Prevention
- NIST SP 800-86 Guide to Integrating Forensic Techniques
Related MITRE ATT&CK Techniques
See SKILL.md for specific technique mappings.
Analysis Workflows - analyzing-network-covert-channels-in-malware
Primary Workflow
[Sample Collection] --> [Static Analysis] --> [Dynamic Analysis] --> [IOC Extraction]
|
v
[Report Generation]See SKILL.md for detailed step-by-step procedures.
#!/usr/bin/env python3
"""Network covert channel detection agent for malware traffic analysis.
Detects DNS tunneling, ICMP covert channels, HTTP header steganography,
and protocol abuse in PCAP captures using scapy.
"""
import os
import sys
import json
import math
from collections import Counter, defaultdict
try:
from scapy.all import rdpcap, DNS, DNSQR, ICMP, IP, TCP, Raw
HAS_SCAPY = True
except ImportError:
HAS_SCAPY = False
def shannon_entropy(data):
"""Calculate Shannon entropy of byte data."""
if not data:
return 0.0
freq = Counter(data)
length = len(data)
return -sum((c / length) * math.log2(c / length) for c in freq.values())
def detect_dns_tunneling(packets, entropy_threshold=3.5, length_threshold=50):
"""Detect DNS tunneling by analyzing query name entropy and length."""
findings = []
dns_queries = defaultdict(list)
for pkt in packets:
if pkt.haslayer(DNSQR):
qname = pkt[DNSQR].qname.decode("utf-8", errors="replace").rstrip(".")
src = pkt[IP].src if pkt.haslayer(IP) else "?"
labels = qname.split(".")
subdomain = ".".join(labels[:-2]) if len(labels) > 2 else qname
entropy = shannon_entropy(subdomain.encode())
base_domain = ".".join(labels[-2:]) if len(labels) >= 2 else qname
dns_queries[base_domain].append({
"query": qname, "src": src, "entropy": round(entropy, 3),
"subdomain_len": len(subdomain),
})
if entropy > entropy_threshold and len(subdomain) > length_threshold:
findings.append({
"type": "dns_tunneling", "query": qname, "src": src,
"entropy": round(entropy, 3),
"subdomain_length": len(subdomain), "severity": "HIGH",
})
volume_findings = []
for domain, queries in dns_queries.items():
if len(queries) > 100:
avg_entropy = sum(q["entropy"] for q in queries) / len(queries)
if avg_entropy > 3.0:
volume_findings.append({
"type": "dns_high_volume", "domain": domain,
"query_count": len(queries),
"avg_entropy": round(avg_entropy, 3), "severity": "HIGH",
})
return findings[:50], volume_findings
def detect_icmp_covert_channel(packets, payload_threshold=64):
"""Detect ICMP covert channels via payload analysis."""
findings = []
icmp_flows = defaultdict(list)
for pkt in packets:
if pkt.haslayer(ICMP) and pkt.haslayer(Raw):
payload = bytes(pkt[Raw].load)
src = pkt[IP].src if pkt.haslayer(IP) else "?"
dst = pkt[IP].dst if pkt.haslayer(IP) else "?"
entropy = shannon_entropy(payload)
flow_key = f"{src}->{dst}"
icmp_flows[flow_key].append(payload)
if len(payload) > payload_threshold and entropy > 5.0:
findings.append({
"type": "icmp_covert", "src": src, "dst": dst,
"icmp_type": pkt[ICMP].type,
"payload_size": len(payload),
"entropy": round(entropy, 3), "severity": "HIGH",
})
for flow, payloads in icmp_flows.items():
total_bytes = sum(len(p) for p in payloads)
if total_bytes > 10000:
findings.append({
"type": "icmp_exfiltration", "flow": flow,
"total_bytes": total_bytes,
"packet_count": len(payloads), "severity": "HIGH",
})
return findings[:50]
def detect_http_header_covert(packets):
"""Detect covert data in HTTP headers."""
findings = []
for pkt in packets:
if pkt.haslayer(TCP) and pkt.haslayer(Raw):
try:
payload = bytes(pkt[Raw].load).decode("utf-8", errors="replace")
except Exception:
continue
if not payload.startswith(("GET ", "POST ", "HTTP/")):
continue
for line in payload.split("\r\n"):
if ":" not in line:
continue
header, _, value = line.partition(":")
value = value.strip()
if header.lower() == "cookie" and len(value) > 500:
entropy = shannon_entropy(value.encode())
if entropy > 4.5:
findings.append({
"type": "http_cookie_exfil", "header": header,
"value_length": len(value),
"entropy": round(entropy, 3), "severity": "MEDIUM",
})
if header.lower().startswith("x-") and len(value) > 100:
entropy = shannon_entropy(value.encode())
if entropy > 4.0:
findings.append({
"type": "http_custom_header", "header": header,
"value_length": len(value),
"entropy": round(entropy, 3), "severity": "MEDIUM",
})
return findings[:50]
def detect_protocol_anomalies(packets):
"""Detect protocol-level anomalies indicating covert communication."""
findings = []
for pkt in packets:
if pkt.haslayer(IP):
proto = pkt[IP].proto
if proto not in (1, 6, 17, 47, 50, 51):
findings.append({
"type": "unusual_ip_proto", "protocol": proto,
"src": pkt[IP].src, "dst": pkt[IP].dst, "severity": "MEDIUM",
})
return findings[:50]
def generate_report(pcap_path, dns_f, dns_v, icmp_f, http_f, proto_f):
"""Generate covert channel analysis report."""
total = len(dns_f) + len(icmp_f) + len(http_f) + len(proto_f)
return {
"pcap_file": pcap_path, "total_findings": total,
"dns_tunneling": {"count": len(dns_f), "findings": dns_f[:10]},
"dns_volume_anomalies": dns_v[:10],
"icmp_covert": {"count": len(icmp_f), "findings": icmp_f[:10]},
"http_header_covert": {"count": len(http_f), "findings": http_f[:10]},
"protocol_anomalies": {"count": len(proto_f), "findings": proto_f[:10]},
"risk_level": "HIGH" if total > 10 else "MEDIUM" if total > 3 else "LOW",
}
if __name__ == "__main__":
print("=" * 60)
print("Network Covert Channel Detection Agent")
print("DNS tunneling, ICMP covert, HTTP header, protocol abuse")
print("=" * 60)
pcap = sys.argv[1] if len(sys.argv) > 1 else None
if not pcap or not os.path.exists(pcap):
print("\n[DEMO] Usage: python agent.py <capture.pcap>")
print(f" scapy available: {HAS_SCAPY}")
sys.exit(0)
if not HAS_SCAPY:
print("[!] Install scapy: pip install scapy")
sys.exit(1)
print(f"\n[*] Loading: {pcap}")
packets = rdpcap(pcap)
print(f"[*] Packets: {len(packets)}")
dns_f, dns_v = detect_dns_tunneling(packets)
icmp_f = detect_icmp_covert_channel(packets)
http_f = detect_http_header_covert(packets)
proto_f = detect_protocol_anomalies(packets)
report = generate_report(pcap, dns_f, dns_v, icmp_f, http_f, proto_f)
print(f"\n--- DNS Tunneling ({len(dns_f)}) ---")
for f in dns_f[:5]:
print(f" {f['src']} | entropy={f['entropy']} | {f['query'][:60]}")
print(f"\n--- ICMP Covert ({len(icmp_f)}) ---")
for f in icmp_f[:5]:
print(f" {f.get('flow', f.get('src','?'))} | {f.get('payload_size', f.get('total_bytes','?'))}B")
print(f"\n[*] Risk: {report['risk_level']}")
print(json.dumps(report, indent=2, default=str))
Related skills
How it compares
Use as a reporting template after technical analysis, not as a substitute for interactive malware sandboxes or generic debugging skills.
FAQ
Who is analyzing-network-covert-channels-in-malware for?
Developers, founders doing security reviews, and agent users documenting malware network covert-channel findings in a consistent report format.
When should I use analyzing-network-covert-channels-in-malware?
During Ship security reviews after you have analysis results to formalize, or in Operate when investigating suspected covert C2 in software you ship or run.
Is analyzing-network-covert-channels-in-malware safe to install?
Treat it like any third-party skill: review the Security Audits panel on this Prism page and your org policy before enabling shell-capable agents on sensitive malware artifacts.