Communitygithub.com

網路流量事件分析

分析網路封包擷取與流量數據,以識別安全事件中的攻擊者活動,包括 C2 通訊、橫向移動與資料外洩。

網路流量事件分析 是什麼?

此技能提供一個完整的網路取證分析工作流程,用於調查安全事件。它涵蓋從取得 PCAP 或 Zeek 日誌、識別 C2 信標通訊、追蹤橫向移動協定 (SMB、RDP、WinRM),到透過 HTTP 上傳、DNS 隧道與 FTP 等管道偵測資料外洩的過程。此技能支援 Wireshark、Zeek、NetFlow 與 Arkime 等平台,並輔以實用指令、篩選器與概念表,適合 SOC 分析師與事件應變人員。它也能引導分析師擷取 IOCs (惡意 IP、域名、TLS 指紋) 並產生結構化報告。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-network-traffic-for-incidents

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

分析網路流量以應對事件

使用時機

  • SIEM 針對異常網路流量模式發出警示,需要深入調查
  • 懷疑存在 C2 信標,需透過封包層級分析確認
  • 需從網路證據中量化資料外洩的體積或目的地
  • 需透過網路連線追蹤系統間的橫向移動
  • IDS/IPS 警示需要封包層級驗證以確認或排除

請勿用於主機型鑑識分析(程序執行、檔案系統證據);此類情況應使用端點鑑識工具。

先決條件

  • 完整封包擷取 (PCAP) 基礎設施或隨需擷取能力(網路分流器、SPAN 埠)
  • 在分析工作站上安裝 Wireshark 並具備適當顯示篩選器知識
  • 已部署 Zeek(原名 Bro)以產生網路元數據(conn.log, dns.log, http.log, ssl.log)
  • 從網路設備收集 NetFlow/IPFIX 以進行流量分析
  • 網路架構圖,標明 VLAN 佈局、防火牆位置及監控點
  • 威脅情資來源,用於關聯觀察到的網路指標

工作流程

步驟 1:擷取或取得網路流量

取得調查所需的相關流量資料:

即時擷取(若事件正在進行中):

# 在特定介面上根據主機 IP 過濾擷取
tcpdump -i eth0 -w capture.pcap host 10.1.5.42

# 擷取流向特定外部 IP 的 C2 流量
tcpdump -i eth0 -w c2_traffic.pcap host 185.220.101.42

# 擷取時自動輪替(1GB 檔案,保留 10 個)
tcpdump -i eth0 -w capture_%Y%m%d%H%M.pcap -C 1000 -W 10

從現有基礎設施取得:

  • 從完整封包擷取設備(Arkime/Moloch, ExtraHop, Corelight)匯出 PCAP
  • 從 Zeek 叢集拉取調查時間範圍內的 Zeek 日誌
  • 從網路設備匯出 NetFlow 資料,用於高層次流量分析

步驟 2:識別 C2 通訊

偵測命令與控制流量模式:

信標偵測(Zeek conn.log):

# 提取連線至外部 IP 且具有規律間隔的連線
cat conn.log | zeek-cut ts id.orig_h id.resp_h id.resp_p duration orig_bytes resp_bytes \
  | awk '$4 ~ /^185\.220/' | sort -t. -k1,1n -k2,2n

Wireshark 信標分析:

# 篩選流向疑似 C2 IP 的流量
ip.addr == 185.220.101.42

# 篩選非標準埠上的 HTTPS 流量
tcp.port != 443 && ssl

# 篩選可疑域名的 DNS 查詢
dns.qry.name contains "evil" or dns.qry.name matches "^[a-z0-9]{32}\."

# 篩選 HTTP POST(常見的 C2 回報方式)
http.request.method == "POST" && ip.dst == 185.220.101.42

需識別的信標特徵:

  • 連線間隔時間規律(例如每 60 秒,帶有 10-15% 的抖動)
  • 請求和回應的封包大小一致
  • 流向非關聯於合法 CDN 或服務的外部 IP 的 HTTPS 流量
  • 具有高熵子域名的 DNS 查詢(DNS 隧道指標)

步驟 3:分析橫向移動流量

追蹤攻擊者在內部系統間的移動:

橫向移動偵測的關鍵協定:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SMB (TCP 445):     PsExec、檔案共享存取、勒索軟體傳播
RDP (TCP 3389):    遠端桌面連線
WinRM (TCP 5985):  PowerShell 遠端管理
WMI (TCP 135):     遠端命令執行
SSH (TCP 22):      Linux 橫向移動
DCE/RPC (TCP 135): DCOM 型橫向移動

橫向移動的 Wireshark 篩選器:

# SMB 橫向移動
smb2 && ip.src == 10.1.5.42 && ip.dst != 10.1.5.42

# 從受感染主機發起的 RDP 連線
tcp.dstport == 3389 && ip.src == 10.1.5.42

# Kerberos 票證請求(可能為傳遞票證攻擊)
kerberos.msg_type == 12 && ip.src == 10.1.5.42

# NTLM 驗證(可能為傳遞雜湊攻擊)
ntlmssp.auth.username && ip.src == 10.1.5.42

步驟 4:偵測資料外洩

識別未經授權的資料傳輸離開網路:

# 在 Zeek conn.log 中識別大量外送傳輸
cat conn.log | zeek-cut ts id.orig_h id.resp_h id.resp_p orig_bytes \
  | awk '$5 > 100000000' | sort -t$'\t' -k5 -rn

# DNS 隧道偵測(大量 TXT 查詢)
cat dns.log | zeek-cut query qtype | grep TXT | cut -f1 \
  | rev | cut -d. -f1,2 | rev | sort | uniq -c | sort -rn | head

# 異常協定使用(ICMP 隧道、DNS over HTTPS)
cat conn.log | zeek-cut proto id.resp_p orig_bytes | awk '$1 == "icmp" && $3 > 1000'

Wireshark 外洩篩選器:

# 大型 HTTP POST 上傳
http.request.method == "POST" && tcp.len > 10000

# FTP 資料傳輸
ftp-data && ip.src == 10.0.0.0/8

# 具有大型 TXT 回應的 DNS(隧道)
dns.resp.type == 16 && dns.resp.len > 200

步驟 5:提取並關聯 IOCs

從流量分析中取得網路型指標:

  • 受感染主機連線的外部 IP 位址
  • 事件時間範圍內透過 DNS 解析的域名
  • 透過 HTTP/HTTPS 存取的 URL(若已啟用 SSL 檢測)
  • TLS 憑證詳細資料(subject, issuer, serial number, JA3/JA3S 雜湊值)
  • HTTP 請求中的 User-Agent 字串
  • 在 PCAP 中擷取的檔案傳輸(使用 Wireshark Export Objects 提取)

步驟 6:記錄網路鑑識結果

將分析結果編譯成結構化報告,並附上證據參考:

  • 對每項發現引用特定的 PCAP 檔案、封包編號及時間戳記
  • 將關鍵證據的封包擷取以螢幕截圖或匯出的 PDF 形式包含在內
  • 將網路活動對應到事件時間線
  • 將網路發現結果與來自端點鑑識的主機型證據進行關聯

關鍵概念

術語定義
PCAP從網路介面擷取原始網路封包並儲存的檔案格式,用於離線分析
信標 (Beaconing)受感染主機定期向 C2 伺服器發起的網路連線,可透過一致的間隔時間辨識
JA3/JA3S基於 ClientHello 和 ServerHello 參數的 TLS 用戶端與伺服器指紋識別方法;每個應用程式獨一無二
NetFlow/IPFIX由路由器與交換器收集的網路流量元數據(來源、目的、埠、位元組、持續時間),無需完整封包擷取
DNS 隧道將資料編碼於 DNS 查詢與回應中的技術,用以外洩資料或透過 DNS 協定維持 C2 通訊
網路分流器在不影響網路效能的情況下,建立網路流量精確副本的硬體設備
Zeek 日誌由 Zeek 網路分析框架產生的結構化元數據日誌,涵蓋連線、DNS、HTTP、SSL 等

工具與系統

  • Wireshark:開源封包分析器,可在封包層級深入檢查網路協定
  • Zeek:網路分析框架,從即時或已擷取的流量中產生結構化元數據日誌
  • Arkime:開源完整封包擷取與搜尋平台,適用於大規模網路鑑識
  • NetworkMiner:網路鑑識分析工具,可從 PCAP 檔案中提取檔案、影像與憑證
  • RITA:開源信標偵測與 DNS 隧道分析工具,專為 Zeek 日誌設計

常見情境

情境:確認 C2 信標並量化外洩量

背景:EDR 在工作站上偵測到可疑程序,但無法確定外洩的資料量。網路團隊提供涵蓋事件時間範圍的完整封包擷取設備 PCAP。

方法:

  1. 將 PCAP 篩選至來自受感染主機 IP 流向外部目的地的流量
  2. 透過分析連線時間模式(信標偵測)來識別 C2 通道
  3. 從 C2 連線中提取 TLS 憑證與 JA3 雜湊值,用於 IOC 產生
  4. 計算事件期間傳送至 C2 基礎設施的總位元組數
  5. 檢查其他外洩通道(DNS 隧道、雲端儲存上傳)
  6. 使用 Wireshark Export Objects 功能提取任何未加密的檔案

常見陷阱:

  • 僅分析 HTTP 流量,而 C2 在未啟用 SSL 檢測的情況下透過 HTTPS 運作
  • 忽略 DNS 隧道,因為每次查詢的資料量很小(但累積一段時間後顯著)
  • 未將網路時間戳記與端點時間戳記關聯(時區不匹配)
  • 忽略被濫用於外洩的合法雲端服務(OneDrive, Google Drive, Dropbox)

輸出格式

網路流量分析報告
=================================
事件編號:        INC-2025-1547
分析師:          [姓名]
擷取來源:        Arkime 完整封包擷取
分析期間:        2025-11-15 14:00 UTC - 2025-11-15 18:00 UTC
PCAP 總大小:     4.7 GB

C2 通訊
來源:            10.1.5.42 (WKSTN-042)
目的地:          185.220.101.42:443 (HTTPS)
信標間隔:        60 秒 ± 12% 抖動
連線數:          4 小時內 237 次連線
JA3 雜湊值:      a0e9f5d64349fb13191bc781f81f42e1
TLS 憑證:        CN=update.evil[.]com(自簽章)
總計外送資料:    147 MB(傳出)
總計接收資料:    2.3 MB(傳入 - 命令)

橫向移動
10.1.5.42 → 10.1.10.15 (SMB, TCP 445) - 14:35 UTC
10.1.5.42 → 10.1.10.20 (RDP, TCP 3389) - 14:42 UTC
10.1.5.42 → 10.1.1.5  (LDAP, TCP 389) - 15:10 UTC

外洩摘要
協定:            HTTPS 至 C2 伺服器
體積:            147 MB 傳出
持續時間:        14:23 UTC - 18:00 UTC
提取的檔案:      [若可從未加密通道還原,請列出]

DNS 分析
可疑查詢:        0 個 DNS 隧道指標
DGA 偵測:        0 個演算法生成域名

證據參考
PCAP 檔案:        INC-2025-1547_capture.pcap (SHA-256: ...)
Zeek 日誌:        /logs/zeek/2025-11-15/ (conn.log, ssl.log, dns.log)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相關技能