[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ESK0CPRC3DZGMR3KBR286F":3,"skill-same:01M6ESK0CPRC3DZGMR3KBR286F":110},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":67,"commitSha":68,"skillDirectory":69,"forksCount":14,"repositoryHtmlUrl":70,"repositoryHomepageUrl":71,"ownerHtmlUrl":72,"ownerBlogUrl":6,"ownerDescription":73,"updatedAt":74,"install":75,"resources":88},"01M6ESK0CPRC3DZGMR3KBR286F","analyzing-command-and-control-communication",null,"Analyzes malware command-and-control (C2) communication protocols to understand beacon patterns, command structures, data encoding, and infrastructure. Covers HTTP, HTTPS, DNS, and custom protocol C2 analysis for detection development and threat intelligence. Activates for requests involving C2 analysis, beacon detection, C2 protocol reverse engineering, or command-and-control infrastructure mapping.","henriquescastilho\u002Fmy-claude","henriquescastilho","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F153296945?v=4","01M6ESH7EXPXTH9CVQ4K16SRG8","Henrique Scheer","01M6ESH7JHEK2PTNNH4HEH787Z",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fanalyzing-command-and-control-communication\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"communication","control","analyzing command and control communication","analyzing","command","data","de","mapping","intelligence","patterns","cm","threat","analysis","cybersecurity","dns","protocol-analysis","command-and-control","malware","infrastructure","threat intelligence","2026-11-10 10:12:30",false,"---\nname: analyzing-command-and-control-communication\ndescription: 'Analyzes malware command-and-control (C2) communication protocols to\n  understand beacon patterns, command structures, data encoding, and infrastructure.\n  Covers HTTP, HTTPS, DNS, and custom protocol C2 analysis for detection development\n  and threat intelligence. Activates for requests involving C2 analysis, beacon detection,\n  C2 protocol reverse engineering, or command-and-control infrastructure mapping.\n\n  '\ndomain: cybersecurity\nsubdomain: malware-analysis\ntags:\n- malware\n- C2\n- command-and-control\n- beacon\n- protocol-analysis\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- DE.AE-02\n- RS.AN-03\n- ID.RA-01\n- DE.CM-01\nmitre_attack:\n- T1071.001\n- T1573\n- T1571\n- T1008\n- T1095\n---\n\n# Analyzing Command-and-Control Communication\n\n## When to Use\n\n- Reverse engineering a malware sample has revealed network communication that needs protocol analysis\n- Building network-level detection signatures for a specific C2 framework (Cobalt Strike, Metasploit, Sliver)\n- Mapping C2 infrastructure including primary servers, fallback domains, and dead drops\n- Analyzing encrypted or encoded C2 traffic to understand the command set and data format\n- Attributing malware to a threat actor based on C2 infrastructure patterns and tooling\n\n**Do not use** for general network anomaly detection; this is specifically for understanding known or suspected C2 protocols from malware analysis.\n\n## Prerequisites\n\n- PCAP capture of malware network traffic (from sandbox, network tap, or full packet capture)\n- Wireshark\u002Ftshark for packet-level analysis\n- Reverse engineering tools (Ghidra, dnSpy) for understanding C2 code in the malware binary\n- Python 3.8+ with `scapy`, `dpkt`, and `requests` for protocol analysis and replay\n- Threat intelligence databases for C2 infrastructure correlation (VirusTotal, Shodan, Censys)\n- JA3\u002FJA3S fingerprint databases for TLS-based C2 identification\n\n## Workflow\n\n### Step 1: Identify the C2 Channel\n\nDetermine the protocol and transport used for C2 communication:\n\n```\nC2 Communication Channels:\n━━━━━━━━━━━━━━━━━━━━━━━━━\nHTTP\u002FHTTPS:     Most common; uses standard web traffic to blend in\n                Indicators: Regular POST\u002FGET requests, specific URI patterns, custom headers\n\nDNS:            Tunneling data through DNS queries and responses\n                Indicators: High-volume TXT queries, long subdomain names, high entropy\n\nCustom TCP\u002FUDP: Proprietary binary protocol on non-standard port\n                Indicators: Non-HTTP traffic on high ports, unknown protocol\n\nICMP:           Data encoded in ICMP echo\u002Freply payloads\n                Indicators: ICMP packets with large or non-standard payloads\n\nWebSocket:      Persistent bidirectional connection for real-time C2\n                Indicators: WebSocket upgrade followed by binary frames\n\nCloud Services: Using legitimate APIs (Telegram, Discord, Slack, GitHub)\n                Indicators: API calls to cloud services from unexpected processes\n\nEmail:          SMTP\u002FIMAP for C2 commands and data exfiltration\n                Indicators: Automated email operations from non-email processes\n```\n\n### Step 2: Analyze Beacon Pattern\n\nCharacterize the periodic communication pattern:\n\n```python\nfrom scapy.all import rdpcap, IP, TCP\nfrom collections import defaultdict\nimport statistics\nimport json\n\npackets = rdpcap(\"c2_traffic.pcap\")\n\n# Group TCP SYN packets by destination\nconnections = defaultdict(list)\nfor pkt in packets:\n    if IP in pkt and TCP in pkt and (pkt[TCP].flags & 0x02):\n        key = f\"{pkt[IP].dst}:{pkt[TCP].dport}\"\n        connections[key].append(float(pkt.time))\n\n# Analyze each destination for beaconing\nfor dst, times in sorted(connections.items()):\n    if len(times) \u003C 3:\n        continue\n\n    intervals = [times[i+1] - times[i] for i in range(len(times)-1)]\n    avg_interval = statistics.mean(intervals)\n    stdev = statistics.stdev(intervals) if len(intervals) > 1 else 0\n    jitter_pct = (stdev \u002F avg_interval * 100) if avg_interval > 0 else 0\n    duration = times[-1] - times[0]\n\n    beacon_data = {\n        \"destination\": dst,\n        \"connections\": len(times),\n        \"duration_seconds\": round(duration, 1),\n        \"avg_interval_seconds\": round(avg_interval, 1),\n        \"stdev_seconds\": round(stdev, 1),\n        \"jitter_percent\": round(jitter_pct, 1),\n        \"is_beacon\": 5 \u003C avg_interval \u003C 7200 and jitter_pct \u003C 25,\n    }\n\n    if beacon_data[\"is_beacon\"]:\n        print(f\"[!] BEACON DETECTED: {dst}\")\n        print(f\"    Interval: {avg_interval:.0f}s +\u002F- {stdev:.0f}s ({jitter_pct:.0f}% jitter)\")\n        print(f\"    Sessions: {len(times)} over {duration:.0f}s\")\n```\n\n### Step 3: Decode C2 Protocol Structure\n\nReverse engineer the message format from captured traffic:\n\n```python\n# HTTP-based C2 protocol analysis\nimport dpkt\nimport base64\n\nwith open(\"c2_traffic.pcap\", \"rb\") as f:\n    pcap = dpkt.pcap.Reader(f)\n\nfor ts, buf in pcap:\n    eth = dpkt.ethernet.Ethernet(buf)\n    if not isinstance(eth.data, dpkt.ip.IP):\n        continue\n    ip = eth.data\n    if not isinstance(ip.data, dpkt.tcp.TCP):\n        continue\n    tcp = ip.data\n\n    if tcp.dport == 80 or tcp.dport == 443:\n        if len(tcp.data) > 0:\n            try:\n                http = dpkt.http.Request(tcp.data)\n                print(f\"\\n--- C2 REQUEST ---\")\n                print(f\"Method: {http.method}\")\n                print(f\"URI: {http.uri}\")\n                print(f\"Headers: {dict(http.headers)}\")\n                if http.body:\n                    print(f\"Body ({len(http.body)} bytes):\")\n                    # Try Base64 decode\n                    try:\n                        decoded = base64.b64decode(http.body)\n                        print(f\"  Decoded: {decoded[:200]}\")\n                    except:\n                        print(f\"  Raw: {http.body[:200]}\")\n            except:\n                pass\n```\n\n### Step 4: Identify C2 Framework\n\nMatch observed patterns to known C2 frameworks:\n\n```\nKnown C2 Framework Signatures:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nCobalt Strike:\n  - Default URIs: \u002Fpixel, \u002Fsubmit.php, \u002F___utm.gif, \u002Fca, \u002Fdpixel\n  - Malleable C2 profiles customize all traffic characteristics\n  - JA3: varies by profile, catalog at ja3er.com\n  - Watermark in beacon config (unique per license)\n  - Config extraction: use CobaltStrikeParser or 1768.py\n\nMetasploit\u002FMeterpreter:\n  - Default staging URI patterns: random 4-char checksum\n  - Reverse HTTP(S) handler patterns\n  - Meterpreter TLV (Type-Length-Value) protocol structure\n\nSliver:\n  - mTLS, HTTP, DNS, WireGuard transport options\n  - Protobuf-encoded messages\n  - Unique implant ID in communication\n\nCovenant:\n  - .NET-based C2 framework\n  - HTTP with customizable profiles\n  - Task-based command execution\n\nPoshC2:\n  - PowerShell\u002FC# based\n  - HTTP with encrypted payloads\n  - Cookie-based session management\n```\n\n```bash\n# Extract Cobalt Strike beacon configuration from PCAP or sample\npython3 \u003C\u003C 'PYEOF'\n# Using CobaltStrikeParser (pip install cobalt-strike-parser)\nfrom cobalt_strike_parser import BeaconConfig\n\ntry:\n    config = BeaconConfig.from_file(\"suspect.exe\")\n    print(\"Cobalt Strike Beacon Configuration:\")\n    for key, value in config.items():\n        print(f\"  {key}: {value}\")\nexcept Exception as e:\n    print(f\"Not a Cobalt Strike beacon or parse error: {e}\")\nPYEOF\n```\n\n### Step 5: Map C2 Infrastructure\n\nDocument the full C2 infrastructure and failover mechanisms:\n\n```python\n# Infrastructure mapping\nimport requests\nimport json\n\nc2_indicators = {\n    \"primary_c2\": \"185.220.101.42\",\n    \"domains\": [\"update.malicious.com\", \"backup.evil.net\"],\n    \"ports\": [443, 8443],\n    \"failover_dns\": [\"ns1.malicious-dns.com\"],\n}\n\n# Enrich with Shodan\ndef shodan_lookup(ip, api_key):\n    resp = requests.get(f\"https:\u002F\u002Fapi.shodan.io\u002Fshodan\u002Fhost\u002F{ip}?key={api_key}\")\n    if resp.status_code == 200:\n        data = resp.json()\n        return {\n            \"ip\": ip,\n            \"ports\": data.get(\"ports\", []),\n            \"os\": data.get(\"os\"),\n            \"org\": data.get(\"org\"),\n            \"asn\": data.get(\"asn\"),\n            \"country\": data.get(\"country_code\"),\n            \"hostnames\": data.get(\"hostnames\", []),\n            \"last_update\": data.get(\"last_update\"),\n        }\n    return None\n\n# Enrich with passive DNS\ndef pdns_lookup(domain):\n    # Using VirusTotal passive DNS\n    resp = requests.get(\n        f\"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fdomains\u002F{domain}\u002Fresolutions\",\n        headers={\"x-apikey\": VT_API_KEY}\n    )\n    if resp.status_code == 200:\n        data = resp.json()\n        resolutions = []\n        for r in data.get(\"data\", []):\n            resolutions.append({\n                \"ip\": r[\"attributes\"][\"ip_address\"],\n                \"date\": r[\"attributes\"][\"date\"],\n            })\n        return resolutions\n    return []\n```\n\n### Step 6: Create Network Detection Signatures\n\nBuild detection rules based on analyzed C2 characteristics:\n\n```bash\n# Suricata rules for the analyzed C2\ncat \u003C\u003C 'EOF' > c2_detection.rules\n# HTTP beacon pattern\nalert http $HOME_NET any -> $EXTERNAL_NET any (\n    msg:\"MALWARE MalwareX C2 HTTP Beacon\";\n    flow:established,to_server;\n    http.method; content:\"POST\";\n    http.uri; content:\"\u002Fgate.php\"; startswith;\n    http.header; content:\"User-Agent: Mozilla\u002F5.0 (compatible; MSIE 10.0)\";\n    threshold:type threshold, track by_src, count 5, seconds 600;\n    sid:9000010; rev:1;\n)\n\n# JA3 fingerprint match\nalert tls $HOME_NET any -> $EXTERNAL_NET any (\n    msg:\"MALWARE MalwareX TLS JA3 Fingerprint\";\n    ja3.hash; content:\"a0e9f5d64349fb13191bc781f81f42e1\";\n    sid:9000011; rev:1;\n)\n\n# DNS beacon detection (high-entropy subdomain)\nalert dns $HOME_NET any -> any any (\n    msg:\"MALWARE Suspected DNS C2 Tunneling\";\n    dns.query; pcre:\"\u002F^[a-z0-9]{20,}\\.\u002F\";\n    threshold:type threshold, track by_src, count 10, seconds 60;\n    sid:9000012; rev:1;\n)\n\n# Certificate-based detection\nalert tls $HOME_NET any -> $EXTERNAL_NET any (\n    msg:\"MALWARE MalwareX Self-Signed C2 Certificate\";\n    tls.cert_subject; content:\"CN=update.malicious.com\";\n    sid:9000013; rev:1;\n)\nEOF\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Beaconing** | Periodic check-in communication from malware to C2 server at regular intervals, often with jitter to avoid pattern detection |\n| **Jitter** | Randomization applied to beacon interval (e.g., 60s +\u002F- 15%) to make the timing pattern less predictable and harder to detect |\n| **Malleable C2** | Cobalt Strike feature allowing operators to customize all aspects of C2 traffic (URIs, headers, encoding) to mimic legitimate services |\n| **Dead Drop** | Intermediate location (paste site, cloud storage, social media) where C2 commands are posted for the malware to retrieve |\n| **Domain Fronting** | Using a trusted CDN domain in the TLS SNI while routing to a different backend, making C2 traffic appear to go to a legitimate service |\n| **Fast Flux** | Rapidly changing DNS records for C2 domains to distribute across many IPs and resist takedown efforts |\n| **C2 Framework** | Software toolkit providing C2 server, implant generator, and operator interface (Cobalt Strike, Metasploit, Sliver, Covenant) |\n\n## Tools & Systems\n\n- **Wireshark**: Packet analyzer for detailed C2 protocol analysis at the packet level\n- **RITA (Real Intelligence Threat Analytics)**: Open-source tool analyzing Zeek logs for beacon detection and DNS tunneling\n- **CobaltStrikeParser**: Tool extracting Cobalt Strike beacon configuration from samples and memory dumps\n- **JA3\u002FJA3S**: TLS fingerprinting method for identifying C2 frameworks by their TLS implementation characteristics\n- **Shodan\u002FCensys**: Internet scanning platforms for mapping C2 infrastructure and identifying related servers\n\n## Common Scenarios\n\n### Scenario: Reverse Engineering a Custom C2 Protocol\n\n**Context**: A malware sample communicates with its C2 server using an unknown binary protocol over TCP port 8443. The protocol needs to be decoded to understand the command set and build detection signatures.\n\n**Approach**:\n1. Filter PCAP for TCP port 8443 conversations and extract the TCP streams\n2. Analyze the first few exchanges to identify the handshake\u002Fauthentication mechanism\n3. Map the message structure (length prefix, type field, payload encoding)\n4. Cross-reference with Ghidra disassembly of the send\u002Freceive functions in the malware\n5. Identify the command dispatcher and document each command code's function\n6. Build a protocol decoder in Python for ongoing traffic analysis\n7. Create Suricata rules matching the protocol handshake or static header bytes\n\n**Pitfalls**:\n- Assuming the protocol is static; some C2 frameworks negotiate encryption during the handshake\n- Not capturing enough traffic to see all command types (some commands are rare)\n- Missing fallback C2 channels (DNS, ICMP) that activate when the primary channel fails\n- Confusing encrypted payload data with the protocol framing structure\n\n## Output Format\n\n```\nC2 COMMUNICATION ANALYSIS REPORT\n===================================\nSample:           malware.exe (SHA-256: e3b0c44...)\nC2 Framework:     Cobalt Strike 4.9\n\nBEACON CONFIGURATION\nC2 Server:        hxxps:\u002F\u002F185.220.101[.]42\u002Fupdates\nBeacon Type:      HTTPS (reverse)\nSleep:            60 seconds\nJitter:           15%\nUser-Agent:       Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64)\nURI (GET):        \u002Fdpixel\nURI (POST):       \u002Fsubmit.php\nWatermark:        1234567890\n\nPROTOCOL ANALYSIS\nTransport:        HTTPS (TLS 1.2)\nJA3 Hash:         a0e9f5d64349fb13191bc781f81f42e1\nCertificate:      CN=Microsoft Update (self-signed)\nEncoding:         Base64 with XOR key 0x69\nCommand Format:   [4B length][4B command_id][payload]\n\nCOMMAND SET\n0x01 - Sleep          Change beacon interval\n0x02 - Shell          Execute cmd.exe command\n0x03 - Download       Transfer file from C2\n0x04 - Upload         Exfiltrate file to C2\n0x05 - Inject         Process injection\n0x06 - Keylog         Start keylogger\n0x07 - Screenshot     Capture screen\n\nINFRASTRUCTURE\nPrimary:          185.220.101[.]42 (AS12345, Hosting Co, NL)\nFailover:         91.215.85[.]17 (AS67890, VPS Provider, RU)\nDNS:              update.malicious[.]com -> 185.220.101[.]42\nRegistrar:        NameCheap\nRegistration:     2025-09-01\n\nDETECTION SIGNATURES\nSID 9000010:      HTTP beacon pattern\nSID 9000011:      JA3 TLS fingerprint\nSID 9000013:      C2 certificate match\n```\n","# Analyzing Command-and-Control Communication\n\n## When to Use\n\n- Reverse engineering a malware sample has revealed network communication that needs protocol analysis\n- Building network-level detection signatures for a specific C2 framework (Cobalt Strike, Metasploit, Sliver)\n- Mapping C2 infrastructure including primary servers, fallback domains, and dead drops\n- Analyzing encrypted or encoded C2 traffic to understand the command set and data format\n- Attributing malware to a threat actor based on C2 infrastructure patterns and tooling\n\n**Do not use** for general network anomaly detection; this is specifically for understanding known or suspected C2 protocols from malware analysis.\n\n## Prerequisites\n\n- PCAP capture of malware network traffic (from sandbox, network tap, or full packet capture)\n- Wireshark\u002Ftshark for packet-level analysis\n- Reverse engineering tools (Ghidra, dnSpy) for understanding C2 code in the malware binary\n- Python 3.8+ with `scapy`, `dpkt`, and `requests` for protocol analysis and replay\n- Threat intelligence databases for C2 infrastructure correlation (VirusTotal, Shodan, Censys)\n- JA3\u002FJA3S fingerprint databases for TLS-based C2 identification\n\n## Workflow\n\n### Step 1: Identify the C2 Channel\n\nDetermine the protocol and transport used for C2 communication:\n\n```\nC2 Communication Channels:\n━━━━━━━━━━━━━━━━━━━━━━━━━\nHTTP\u002FHTTPS:     Most common; uses standard web traffic to blend in\n                Indicators: Regular POST\u002FGET requests, specific URI patterns, custom headers\n\nDNS:            Tunneling data through DNS queries and responses\n                Indicators: High-volume TXT queries, long subdomain names, high entropy\n\nCustom TCP\u002FUDP: Proprietary binary protocol on non-standard port\n                Indicators: Non-HTTP traffic on high ports, unknown protocol\n\nICMP:           Data encoded in ICMP echo\u002Freply payloads\n                Indicators: ICMP packets with large or non-standard payloads\n\nWebSocket:      Persistent bidirectional connection for real-time C2\n                Indicators: WebSocket upgrade followed by binary frames\n\nCloud Services: Using legitimate APIs (Telegram, Discord, Slack, GitHub)\n                Indicators: API calls to cloud services from unexpected processes\n\nEmail:          SMTP\u002FIMAP for C2 commands and data exfiltration\n                Indicators: Automated email operations from non-email processes\n```\n\n### Step 2: Analyze Beacon Pattern\n\nCharacterize the periodic communication pattern:\n\n```python\nfrom scapy.all import rdpcap, IP, TCP\nfrom collections import defaultdict\nimport statistics\nimport json\n\npackets = rdpcap(\"c2_traffic.pcap\")\n\n# Group TCP SYN packets by destination\nconnections = defaultdict(list)\nfor pkt in packets:\n    if IP in pkt and TCP in pkt and (pkt[TCP].flags & 0x02):\n        key = f\"{pkt[IP].dst}:{pkt[TCP].dport}\"\n        connections[key].append(float(pkt.time))\n\n# Analyze each destination for beaconing\nfor dst, times in sorted(connections.items()):\n    if len(times) \u003C 3:\n        continue\n\n    intervals = [times[i+1] - times[i] for i in range(len(times)-1)]\n    avg_interval = statistics.mean(intervals)\n    stdev = statistics.stdev(intervals) if len(intervals) > 1 else 0\n    jitter_pct = (stdev \u002F avg_interval * 100) if avg_interval > 0 else 0\n    duration = times[-1] - times[0]\n\n    beacon_data = {\n        \"destination\": dst,\n        \"connections\": len(times),\n        \"duration_seconds\": round(duration, 1),\n        \"avg_interval_seconds\": round(avg_interval, 1),\n        \"stdev_seconds\": round(stdev, 1),\n        \"jitter_percent\": round(jitter_pct, 1),\n        \"is_beacon\": 5 \u003C avg_interval \u003C 7200 and jitter_pct \u003C 25,\n    }\n\n    if beacon_data[\"is_beacon\"]:\n        print(f\"[!] BEACON DETECTED: {dst}\")\n        print(f\"    Interval: {avg_interval:.0f}s +\u002F- {stdev:.0f}s ({jitter_pct:.0f}% jitter)\")\n        print(f\"    Sessions: {len(times)} over {duration:.0f}s\")\n```\n\n### Step 3: Decode C2 Protocol Structure\n\nReverse engineer the message format from captured traffic:\n\n```python\n# HTTP-based C2 protocol analysis\nimport dpkt\nimport base64\n\nwith open(\"c2_traffic.pcap\", \"rb\") as f:\n    pcap = dpkt.pcap.Reader(f)\n\nfor ts, buf in pcap:\n    eth = dpkt.ethernet.Ethernet(buf)\n    if not isinstance(eth.data, dpkt.ip.IP):\n        continue\n    ip = eth.data\n    if not isinstance(ip.data, dpkt.tcp.TCP):\n        continue\n    tcp = ip.data\n\n    if tcp.dport == 80 or tcp.dport == 443:\n        if len(tcp.data) > 0:\n            try:\n                http = dpkt.http.Request(tcp.data)\n                print(f\"\\n--- C2 REQUEST ---\")\n                print(f\"Method: {http.method}\")\n                print(f\"URI: {http.uri}\")\n                print(f\"Headers: {dict(http.headers)}\")\n                if http.body:\n                    print(f\"Body ({len(http.body)} bytes):\")\n                    # Try Base64 decode\n                    try:\n                        decoded = base64.b64decode(http.body)\n                        print(f\"  Decoded: {decoded[:200]}\")\n                    except:\n                        print(f\"  Raw: {http.body[:200]}\")\n            except:\n                pass\n```\n\n### Step 4: Identify C2 Framework\n\nMatch observed patterns to known C2 frameworks:\n\n```\nKnown C2 Framework Signatures:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nCobalt Strike:\n  - Default URIs: \u002Fpixel, \u002Fsubmit.php, \u002F___utm.gif, \u002Fca, \u002Fdpixel\n  - Malleable C2 profiles customize all traffic characteristics\n  - JA3: varies by profile, catalog at ja3er.com\n  - Watermark in beacon config (unique per license)\n  - Config extraction: use CobaltStrikeParser or 1768.py\n\nMetasploit\u002FMeterpreter:\n  - Default staging URI patterns: random 4-char checksum\n  - Reverse HTTP(S) handler patterns\n  - Meterpreter TLV (Type-Length-Value) protocol structure\n\nSliver:\n  - mTLS, HTTP, DNS, WireGuard transport options\n  - Protobuf-encoded messages\n  - Unique implant ID in communication\n\nCovenant:\n  - .NET-based C2 framework\n  - HTTP with customizable profiles\n  - Task-based command execution\n\nPoshC2:\n  - PowerShell\u002FC# based\n  - HTTP with encrypted payloads\n  - Cookie-based session management\n```\n\n```bash\n# Extract Cobalt Strike beacon configuration from PCAP or sample\npython3 \u003C\u003C 'PYEOF'\n# Using CobaltStrikeParser (pip install cobalt-strike-parser)\nfrom cobalt_strike_parser import BeaconConfig\n\ntry:\n    config = BeaconConfig.from_file(\"suspect.exe\")\n    print(\"Cobalt Strike Beacon Configuration:\")\n    for key, value in config.items():\n        print(f\"  {key}: {value}\")\nexcept Exception as e:\n    print(f\"Not a Cobalt Strike beacon or parse error: {e}\")\nPYEOF\n```\n\n### Step 5: Map C2 Infrastructure\n\nDocument the full C2 infrastructure and failover mechanisms:\n\n```python\n# Infrastructure mapping\nimport requests\nimport json\n\nc2_indicators = {\n    \"primary_c2\": \"185.220.101.42\",\n    \"domains\": [\"update.malicious.com\", \"backup.evil.net\"],\n    \"ports\": [443, 8443],\n    \"failover_dns\": [\"ns1.malicious-dns.com\"],\n}\n\n# Enrich with Shodan\ndef shodan_lookup(ip, api_key):\n    resp = requests.get(f\"https:\u002F\u002Fapi.shodan.io\u002Fshodan\u002Fhost\u002F{ip}?key={api_key}\")\n    if resp.status_code == 200:\n        data = resp.json()\n        return {\n            \"ip\": ip,\n            \"ports\": data.get(\"ports\", []),\n            \"os\": data.get(\"os\"),\n            \"org\": data.get(\"org\"),\n            \"asn\": data.get(\"asn\"),\n            \"country\": data.get(\"country_code\"),\n            \"hostnames\": data.get(\"hostnames\", []),\n            \"last_update\": data.get(\"last_update\"),\n        }\n    return None\n\n# Enrich with passive DNS\ndef pdns_lookup(domain):\n    # Using VirusTotal passive DNS\n    resp = requests.get(\n        f\"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fdomains\u002F{domain}\u002Fresolutions\",\n        headers={\"x-apikey\": VT_API_KEY}\n    )\n    if resp.status_code == 200:\n        data = resp.json()\n        resolutions = []\n        for r in data.get(\"data\", []):\n            resolutions.append({\n                \"ip\": r[\"attributes\"][\"ip_address\"],\n                \"date\": r[\"attributes\"][\"date\"],\n            })\n        return resolutions\n    return []\n```\n\n### Step 6: Create Network Detection Signatures\n\nBuild detection rules based on analyzed C2 characteristics:\n\n```bash\n# Suricata rules for the analyzed C2\ncat \u003C\u003C 'EOF' > c2_detection.rules\n# HTTP beacon pattern\nalert http $HOME_NET any -> $EXTERNAL_NET any (\n    msg:\"MALWARE MalwareX C2 HTTP Beacon\";\n    flow:established,to_server;\n    http.method; content:\"POST\";\n    http.uri; content:\"\u002Fgate.php\"; startswith;\n    http.header; content:\"User-Agent: Mozilla\u002F5.0 (compatible; MSIE 10.0)\";\n    threshold:type threshold, track by_src, count 5, seconds 600;\n    sid:9000010; rev:1;\n)\n\n# JA3 fingerprint match\nalert tls $HOME_NET any -> $EXTERNAL_NET any (\n    msg:\"MALWARE MalwareX TLS JA3 Fingerprint\";\n    ja3.hash; content:\"a0e9f5d64349fb13191bc781f81f42e1\";\n    sid:9000011; rev:1;\n)\n\n# DNS beacon detection (high-entropy subdomain)\nalert dns $HOME_NET any -> any any (\n    msg:\"MALWARE Suspected DNS C2 Tunneling\";\n    dns.query; pcre:\"\u002F^[a-z0-9]{20,}\\.\u002F\";\n    threshold:type threshold, track by_src, count 10, seconds 60;\n    sid:9000012; rev:1;\n)\n\n# Certificate-based detection\nalert tls $HOME_NET any -> $EXTERNAL_NET any (\n    msg:\"MALWARE MalwareX Self-Signed C2 Certificate\";\n    tls.cert_subject; content:\"CN=update.malicious.com\";\n    sid:9000013; rev:1;\n)\nEOF\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Beaconing** | Periodic check-in communication from malware to C2 server at regular intervals, often with jitter to avoid pattern detection |\n| **Jitter** | Randomization applied to beacon interval (e.g., 60s +\u002F- 15%) to make the timing pattern less predictable and harder to detect |\n| **Malleable C2** | Cobalt Strike feature allowing operators to customize all aspects of C2 traffic (URIs, headers, encoding) to mimic legitimate services |\n| **Dead Drop** | Intermediate location (paste site, cloud storage, social media) where C2 commands are posted for the malware to retrieve |\n| **Domain Fronting** | Using a trusted CDN domain in the TLS SNI while routing to a different backend, making C2 traffic appear to go to a legitimate service |\n| **Fast Flux** | Rapidly changing DNS records for C2 domains to distribute across many IPs and resist takedown efforts |\n| **C2 Framework** | Software toolkit providing C2 server, implant generator, and operator interface (Cobalt Strike, Metasploit, Sliver, Covenant) |\n\n## Tools & Systems\n\n- **Wireshark**: Packet analyzer for detailed C2 protocol analysis at the packet level\n- **RITA (Real Intelligence Threat Analytics)**: Open-source tool analyzing Zeek logs for beacon detection and DNS tunneling\n- **CobaltStrikeParser**: Tool extracting Cobalt Strike beacon configuration from samples and memory dumps\n- **JA3\u002FJA3S**: TLS fingerprinting method for identifying C2 frameworks by their TLS implementation characteristics\n- **Shodan\u002FCensys**: Internet scanning platforms for mapping C2 infrastructure and identifying related servers\n\n## Common Scenarios\n\n### Scenario: Reverse Engineering a Custom C2 Protocol\n\n**Context**: A malware sample communicates with its C2 server using an unknown binary protocol over TCP port 8443. The protocol needs to be decoded to understand the command set and build detection signatures.\n\n**Approach**:\n1. Filter PCAP for TCP port 8443 conversations and extract the TCP streams\n2. Analyze the first few exchanges to identify the handshake\u002Fauthentication mechanism\n3. Map the message structure (length prefix, type field, payload encoding)\n4. Cross-reference with Ghidra disassembly of the send\u002Freceive functions in the malware\n5. Identify the command dispatcher and document each command code's function\n6. Build a protocol decoder in Python for ongoing traffic analysis\n7. Create Suricata rules matching the protocol handshake or static header bytes\n\n**Pitfalls**:\n- Assuming the protocol is static; some C2 frameworks negotiate encryption during the handshake\n- Not capturing enough traffic to see all command types (some commands are rare)\n- Missing fallback C2 channels (DNS, ICMP) that activate when the primary channel fails\n- Confusing encrypted payload data with the protocol framing structure\n\n## Output Format\n\n```\nC2 COMMUNICATION ANALYSIS REPORT\n===================================\nSample:           malware.exe (SHA-256: e3b0c44...)\nC2 Framework:     Cobalt Strike 4.9\n\nBEACON CONFIGURATION\nC2 Server:        hxxps:\u002F\u002F185.220.101[.]42\u002Fupdates\nBeacon Type:      HTTPS (reverse)\nSleep:            60 seconds\nJitter:           15%\nUser-Agent:       Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64)\nURI (GET):        \u002Fdpixel\nURI (POST):       \u002Fsubmit.php\nWatermark:        1234567890\n\nPROTOCOL ANALYSIS\nTransport:        HTTPS (TLS 1.2)\nJA3 Hash:         a0e9f5d64349fb13191bc781f81f42e1\nCertificate:      CN=Microsoft Update (self-signed)\nEncoding:         Base64 with XOR key 0x69\nCommand Format:   [4B length][4B command_id][payload]\n\nCOMMAND SET\n0x01 - Sleep          Change beacon interval\n0x02 - Shell          Execute cmd.exe command\n0x03 - Download       Transfer file from C2\n0x04 - Upload         Exfiltrate file to C2\n0x05 - Inject         Process injection\n0x06 - Keylog         Start keylogger\n0x07 - Screenshot     Capture screen\n\nINFRASTRUCTURE\nPrimary:          185.220.101[.]42 (AS12345, Hosting Co, NL)\nFailover:         91.215.85[.]17 (AS67890, VPS Provider, RU)\nDNS:              update.malicious[.]com -> 185.220.101[.]42\nRegistrar:        NameCheap\nRegistration:     2025-09-01\n\nDETECTION SIGNATURES\nSID 9000010:      HTTP beacon pattern\nSID 9000011:      JA3 TLS fingerprint\nSID 9000013:      C2 certificate match\n```\n",{"name":5,"tags":49,"author":52,"domain":37,"license":15,"version":53,"nist_csf":54,"subdomain":59,"description":60,"mitre_attack":61},[41,50,40,51,39],"C2","beacon","mahipal","1.0.0",[55,56,57,58],"DE.AE-02","RS.AN-03","ID.RA-01","DE.CM-01","malware-analysis","Analyzes malware command-and-control (C2) communication protocols to understand beacon patterns, command structures, data encoding, and infrastructure. Covers HTTP, HTTPS, DNS, and custom protocol C2 analysis for detection development and threat intelligence. Activates for requests involving C2 analysis, beacon detection, C2 protocol reverse engineering, or command-and-control infrastructure mapping.\n",[62,63,64,65,66],"T1071.001","T1573","T1571","T1008","T1095","main","7925716f065257435fdb12e97f7e52842147d5ad",".claude\u002Fskills\u002Fanalyzing-command-and-control-communication","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude","https:\u002F\u002Fclaude.com\u002Fclaude-code","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho","Software · Applied AI · Quantitative Modeling · Building with Claude.","2026-06-10 12:24:46",{"source":8,"skillName":5,"commands":76,"prompt":86,"zipAvailable":87},[77,80,83],{"tool":78,"command":79},"npx","npx skills add henriquescastilho\u002Fmy-claude --skill analyzing-command-and-control-communication",{"tool":81,"command":82},"bunx","bunx skills add henriquescastilho\u002Fmy-claude --skill analyzing-command-and-control-communication",{"tool":84,"command":85},"pnpm","pnpm dlx skills add henriquescastilho\u002Fmy-claude --skill analyzing-command-and-control-communication","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fanalyzing-command-and-control-communication\u002FSKILL.md",true,[89,95,100,104],{"path":90,"resourceType":91,"resourceTypeDesc":92,"sizeBytes":93,"sourceHtmlUrl":94},"agents\u002Fopenai.yaml","REFERENCE","参考文档",146,"https:\u002F\u002Fgithub.com\u002FAb0umar\u002Fselrs.cc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fretro\u002Fagents\u002Fopenai.yaml",{"path":96,"resourceType":96,"resourceTypeDesc":97,"sizeBytes":98,"sourceHtmlUrl":99},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fanalyzing-command-and-control-communication\u002FLICENSE",{"path":101,"resourceType":91,"resourceTypeDesc":92,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fapi-reference.md",2756,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fanalyzing-command-and-control-communication\u002Freferences\u002Fapi-reference.md",{"path":105,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":108,"sourceHtmlUrl":109},"scripts\u002Fagent.py","SCRIPT","脚本",7849,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fanalyzing-command-and-control-communication\u002Fscripts\u002Fagent.py",[111,152,161,170,192,217],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":115,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":132,"publishedAt":44},"01M6F0B6XPQ65AX2X0DWK8KT3E","markitdown","Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.","MIT","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[118,121,124,127],{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":122,"categoryName":123,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":125,"categoryName":126,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格",{"categoryNo":128,"categoryName":129,"taxonomyType":130,"taxonomyTypeDesc":131},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[113,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151],"docx","PDF","pptx","xlsx","documents","csv","ocr","Audio","Bash","markdown","convert","read","write","edit","html","images","files","youtube","with",{"skillNo":153,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":115,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":160,"publishedAt":44},"01M6F06SBHR9F0SDWE282Y8075","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fscientific_writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[156,157,158,159],{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":122,"categoryName":123,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":125,"categoryName":126,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":128,"categoryName":129,"taxonomyType":130,"taxonomyTypeDesc":131},[113,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151],{"skillNo":162,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":115,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":169,"publishedAt":44},"01M6F02D4R14EJAPBWVDF9J9VQ","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[165,166,167,168],{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":122,"categoryName":123,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":125,"categoryName":126,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":128,"categoryName":129,"taxonomyType":130,"taxonomyTypeDesc":131},[113,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151],{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":115,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":44},"01M6F000KS6YB4MKS774G4R8ND","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fzarr-python\u002FSKILL.md",[],[177,178,179,180,181,182,183,184,185,186,187,188,189,190,191],"python","zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":115,"licenseFileUrl":6,"sourceHtmlUrl":196,"categories":197,"keywords":199,"publishedAt":44},"01M6EZZJWFXM1GR78KTW6J0DN8","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fwhat-if-oracle\u002FSKILL.md",[198],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[200,201,202,203,204,205,36,206,207,208,209,144,145,210,211,212,213,214,215,216],"oracle","what if oracle","go","run","ux","futures","explore","decision","branch","question","idea","exploration","options","stress-test","strategies","scenario","stress",{"skillNo":218,"name":219,"nameZh":6,"description":220,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":115,"licenseFileUrl":6,"sourceHtmlUrl":221,"categories":222,"keywords":233,"publishedAt":44},"01M6EZZCXAEB49RXGQCJX5E8GB","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fvenue-templates\u002FSKILL.md",[223,226,229,230],{"categoryNo":224,"categoryName":225,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":227,"categoryName":228,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":231,"categoryName":232,"taxonomyType":130,"taxonomyTypeDesc":131},"01JBSEEDCAT000000000000036","内容创作者",[234,235,236,237,238,239,240,241,141,242,144,145,146,243,244,245,246,247,191,248],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements","formatting","journal","chi"]