Communitygithub.com

网络安全事件网络流量分析

分析网络流量捕获和流数据,以识别安全事件中的对手活动。

网络安全事件网络流量分析 是什么?

该技能专为安全事件响应团队设计,帮助分析师通过深入分析网络流量捕获(PCAP)和流数据(如 Zeek 日志、NetFlow),识别命令与控制(C2)通信、横向移动、数据泄露等恶意活动。它涵盖了从流量捕获、C2 信标检测、横向移动分析、数据泄露量化到 IOC 提取与报告撰写的完整工作流。该技能要求部署 PCAP 基础设施(如 tcpdump、Arkime)、Zeek 元数据生成、Wireshark 等工具,并需要网络架构图和威胁情报支持。其主要适用场景包括 SIEM 告警调查、C2 信标确认、横向移动追溯、IDS/IPS 告警验证。通过结构化流程和常见陷阱提示,该工具可显著提升网络取证分析的专业性和效率。

兼容平台~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:捕获或获取网络流量

获取调查相关的流量数据:

实时捕获(如果事件仍在进行):

# 在特定接口上按主机过滤捕获
sudo tcpdump -i eth0 -w capture.pcap host 10.1.5.42

# 捕获到特定外部 IP 的 C2 流量
sudo tcpdump -i eth0 -w c2_traffic.pcap host 185.220.101.42

# 使用轮转捕获(每文件 1GB,保留 10 个文件)
sudo 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:提取和关联 IOC

从流量分析中提取基于网络的指标:

  • 受感染主机联系的外部 IP 地址
  • 事件期间通过 DNS 解析的域
  • 通过 HTTP/HTTPS 访问的 URL(如果启用了 SSL 检查)
  • TLS 证书详细信息(主题、颁发者、序列号、JA3/JA3S 哈希值)
  • HTTP 请求中的 User-Agent 字符串
  • 在 PCAP 中捕获的文件传输(使用 Wireshark 导出对象功能提取)

步骤 6:记录网络取证发现

将分析结果整理成结构化报告,并附带证据引用:

  • 为每个发现引用具体的 PCAP 文件、帧编号和时间戳
  • 将关键证据的数据包捕获作为屏幕截图或导出的 PDF 包含在内
  • 将网络活动映射到事件时间线
  • 将网络发现与端点取证的基于主机的证据相关联

关键概念

术语定义
PCAP(数据包捕获)存储从网络接口捕获的原始网络数据包的文件格式,用于离线分析
信标(Beaconing)受感染主机向 C2 服务器定期发送的网络连接,通过一致的定时间隔可识别
JA3/JA3S基于 ClientHello 和 ServerHello 参数的 TLS 客户端和服务器指纹识别方法;每个应用唯一
NetFlow/IPFIX由路由器和交换机收集的网络流量元数据(源、目标、端口、字节数、持续时间),无需全包捕获
DNS 隧道一种将数据编码到 DNS 查询和响应中的技术,用于通过 DNS 协议泄露数据或维持 C2 通信
网络分流器一种硬件设备,可创建网络流量的精确副本用于监控,不会影响网络性能
Zeek 日志由 Zeek 网络分析框架生成的结构化元数据日志,涵盖连接、DNS、HTTP、SSL 等

工具与系统

  • Wireshark:开源数据包分析器,用于在数据包级别深入检查网络协议
  • Zeek(原名 Bro):网络分析框架,从实时或捕获的流量生成结构化元数据日志
  • Arkime(原名 Moloch):开源的全包捕获和搜索平台,用于大规模网络取证
  • NetworkMiner:网络取证分析工具,用于从 PCAP 文件中提取文件、图像和凭据
  • RITA(实时智能威胁分析):针对 Zeek 日志的开源信标检测和 DNS 隧道分析工具

常见场景

场景:确认 C2 信标并量化泄露量

背景:EDR 检测到工作站上的可疑进程,但无法确定泄露的数据量。网络团队提供来自全包捕获设备的事件时间段 PCAP。

方法:

  1. 将 PCAP 过滤到从受感染主机 IP 到外部目的地的流量
  2. 通过分析连接定时模式(信标检测)识别 C2 信道
  3. 从 C2 连接中提取 TLS 证书和 JA3 哈希以生成 IOC
  4. 计算事件持续时间内发送到 C2 基础设施的总字节数
  5. 检查其他泄露渠道(DNS 隧道、云存储上传)
  6. 使用 Wireshark 导出对象功能提取任何未加密的文件传输

陷阱:

  • 仅分析 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,

相关技能