collecting-volatile-evidence-from-compromised-host

按照易失性顺序从受攻陷系统收集易失性取证证据,在数据丢失前保全内存、网络连接、进程和系统状态。

9 stars

Best use case

collecting-volatile-evidence-from-compromised-host is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

按照易失性顺序从受攻陷系统收集易失性取证证据,在数据丢失前保全内存、网络连接、进程和系统状态。

Teams using collecting-volatile-evidence-from-compromised-host should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/collecting-volatile-evidence-from-compromised-host/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/collecting-volatile-evidence-from-compromised-host/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/collecting-volatile-evidence-from-compromised-host/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How collecting-volatile-evidence-from-compromised-host Compares

Feature / Agentcollecting-volatile-evidence-from-compromised-hostStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

按照易失性顺序从受攻陷系统收集易失性取证证据,在数据丢失前保全内存、网络连接、进程和系统状态。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 从受攻陷主机收集易失性证据(Volatile Evidence)

## 适用场景

- 安全事件已确认且受攻陷主机已识别
- 系统隔离、关机或修复开始前
- 怀疑存在内存驻留恶意软件(无文件攻击)
- 需要捕获网络连接、运行中的进程和系统状态
- 法律程序可能要求取证证据保全
- 事件需要基于易失性数据的根因分析

## 前置条件

- USB 或网络共享上的取证采集工具包(可信工具)
- 用于内存采集的 WinPmem/LiME
- 用于磁盘镜像的写保护器或取证工作站
- 证据监管链(Chain of Custody)文档表格
- 具备完整性验证的安全证据存储
- 证据采集授权(内部人员案件需法律/HR 审批)

## 工作流程

### 步骤 1:准备采集环境

```bash
# 挂载取证 USB 工具包(不要在受攻陷系统上安装工具)
# 验证工具包完整性
sha256sum /mnt/forensic_usb/tools/* > /tmp/toolkit_hashes.txt
diff /mnt/forensic_usb/tools/known_good_hashes.txt /tmp/toolkit_hashes.txt

# 创建带时间戳的证据输出目录
EVIDENCE_DIR="/mnt/evidence/$(hostname)_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$EVIDENCE_DIR"
echo "Collection started: $(date -u)" > "$EVIDENCE_DIR/collection_log.txt"
echo "Collector: $(whoami)" >> "$EVIDENCE_DIR/collection_log.txt"
echo "System: $(hostname)" >> "$EVIDENCE_DIR/collection_log.txt"
```

### 步骤 2:采集系统内存(最高易失性)

```bash
# Windows - WinPmem 内存采集
winpmem_mini_x64.exe "$EVIDENCE_DIR\memdump_$(hostname).raw"

# Linux - LiME 内核模块内存采集
insmod /mnt/forensic_usb/lime.ko "path=$EVIDENCE_DIR/memdump_$(hostname).lime format=lime"

# Linux - 通过 /proc/kcore 替代方案
dd if=/proc/kcore of="$EVIDENCE_DIR/kcore_dump.raw" bs=1M

# macOS - osxpmem
osxpmem -o "$EVIDENCE_DIR/memdump_$(hostname).aff4"

# 立即对内存转储文件计算哈希
sha256sum "$EVIDENCE_DIR/memdump_"* > "$EVIDENCE_DIR/memory_hash.sha256"
```

### 步骤 3:采集网络状态

```bash
# 活跃网络连接
# Windows
netstat -anob > "$EVIDENCE_DIR/netstat_connections.txt" 2>&1
Get-NetTCPConnection | Export-Csv "$EVIDENCE_DIR/tcp_connections.csv" -NoTypeInformation
Get-NetUDPEndpoint | Export-Csv "$EVIDENCE_DIR/udp_endpoints.csv" -NoTypeInformation

# Linux
ss -tulnp > "$EVIDENCE_DIR/socket_stats.txt"
netstat -anp > "$EVIDENCE_DIR/netstat_all.txt" 2>/dev/null
cat /proc/net/tcp > "$EVIDENCE_DIR/proc_net_tcp.txt"
cat /proc/net/udp > "$EVIDENCE_DIR/proc_net_udp.txt"

# ARP 缓存
arp -a > "$EVIDENCE_DIR/arp_cache.txt"

# 路由表
route print > "$EVIDENCE_DIR/routing_table.txt"  # Windows
ip route show > "$EVIDENCE_DIR/routing_table.txt"  # Linux

# DNS 缓存
ipconfig /displaydns > "$EVIDENCE_DIR/dns_cache.txt"  # Windows
# Linux:因解析器不同而异,检查 systemd-resolve 或 nscd
systemd-resolve --statistics > "$EVIDENCE_DIR/dns_stats.txt" 2>/dev/null

# 活跃防火墙规则
netsh advfirewall show allprofiles > "$EVIDENCE_DIR/firewall_rules.txt"  # Windows
iptables -L -n -v > "$EVIDENCE_DIR/iptables_rules.txt"  # Linux
```

### 步骤 4:采集运行中的进程

```bash
# Windows - 详细进程列表
tasklist /V /FO CSV > "$EVIDENCE_DIR/process_list_verbose.csv"
wmic process list full > "$EVIDENCE_DIR/wmic_process_full.txt"
Get-Process | Select-Object Id,ProcessName,Path,StartTime,CPU,WorkingSet |
  Export-Csv "$EVIDENCE_DIR/ps_processes.csv" -NoTypeInformation

# Windows - 带命令行和父进程的进程信息
wmic process get ProcessId,Name,CommandLine,ParentProcessId,ExecutablePath /FORMAT:CSV > \
  "$EVIDENCE_DIR/process_commandlines.csv"

# Linux - 完整进程树
ps auxwwf > "$EVIDENCE_DIR/process_tree.txt"
ps -eo pid,ppid,user,args --forest > "$EVIDENCE_DIR/process_forest.txt"
cat /proc/*/cmdline 2>/dev/null | tr '\0' ' ' > "$EVIDENCE_DIR/proc_cmdline_all.txt"

# 已加载的进程模块/DLL
# Windows
listdlls.exe -accepteula > "$EVIDENCE_DIR/loaded_dlls.txt"
# Linux
for pid in $(ls /proc/ | grep -E '^[0-9]+$'); do
  echo "=== PID $pid ===" >> "$EVIDENCE_DIR/proc_maps.txt"
  cat "/proc/$pid/maps" 2>/dev/null >> "$EVIDENCE_DIR/proc_maps.txt"
done

# 打开的文件句柄
handle.exe -accepteula > "$EVIDENCE_DIR/open_handles.txt"  # Windows (Sysinternals)
lsof > "$EVIDENCE_DIR/open_files.txt"  # Linux
```

### 步骤 5:采集已登录用户和会话

```bash
# Windows
query user > "$EVIDENCE_DIR/logged_in_users.txt"
query session > "$EVIDENCE_DIR/active_sessions.txt"
net session > "$EVIDENCE_DIR/net_sessions.txt" 2>&1
net use > "$EVIDENCE_DIR/mapped_drives.txt" 2>&1

# Linux
who > "$EVIDENCE_DIR/who_output.txt"
w > "$EVIDENCE_DIR/w_output.txt"
last -50 > "$EVIDENCE_DIR/last_logins.txt"
lastlog > "$EVIDENCE_DIR/lastlog.txt"
cat /var/log/auth.log | tail -200 > "$EVIDENCE_DIR/recent_auth.txt" 2>/dev/null
```

### 步骤 6:采集系统配置状态

```bash
# 系统时间(对时间线至关重要)
date -u > "$EVIDENCE_DIR/system_time_utc.txt"
w32tm /query /status > "$EVIDENCE_DIR/ntp_status.txt"  # Windows
ntpq -p > "$EVIDENCE_DIR/ntp_status.txt"  # Linux

# 环境变量
set > "$EVIDENCE_DIR/environment_vars.txt"  # Windows
env > "$EVIDENCE_DIR/environment_vars.txt"  # Linux

# 计划任务 / Cron 作业
schtasks /query /fo CSV /v > "$EVIDENCE_DIR/scheduled_tasks.csv"  # Windows
crontab -l > "$EVIDENCE_DIR/crontab_current.txt" 2>/dev/null  # Linux
ls -la /etc/cron.* > "$EVIDENCE_DIR/cron_dirs.txt" 2>/dev/null

# 服务
sc queryex type=service state=all > "$EVIDENCE_DIR/services_all.txt"  # Windows
systemctl list-units --type=service --all > "$EVIDENCE_DIR/systemd_services.txt"  # Linux

# Windows 注册表 - 关键自启动位置
reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "$EVIDENCE_DIR/reg_run_hklm.reg" /y
reg export "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "$EVIDENCE_DIR/reg_run_hkcu.reg" /y
reg export "HKLM\SYSTEM\CurrentControlSet\Services" "$EVIDENCE_DIR/reg_services.reg" /y
```

### 步骤 7:对所有证据计算哈希并记录监管链

```bash
# 为所有已采集证据生成 SHA256 哈希
cd "$EVIDENCE_DIR"
sha256sum * > evidence_manifest.sha256

# 创建证据监管链记录
cat > "$EVIDENCE_DIR/chain_of_custody.txt" << EOF
证据监管链记录(CHAIN OF CUSTODY RECORD)
========================
案例 ID: IR-YYYY-NNN
采集日期: $(date -u)
采集人: $(whoami)
系统: $(hostname)
系统 IP: $(hostname -I 2>/dev/null || ipconfig | grep IPv4)
采集方式: 通过可信 USB 工具包进行实时取证采集

证据项目:
$(ls -la "$EVIDENCE_DIR/" | grep -v chain_of_custody)

SHA256 清单: evidence_manifest.sha256
转移记录: [待填写]
存储位置: [待填写]
EOF
```

## 核心概念

| 概念 | 说明 |
|------|------|
| **易失性顺序(Order of Volatility)** | RFC 3227 - 优先采集最易失数据:寄存器 > 缓存 > 内存 > 磁盘 |
| **实时取证(Live Forensics)** | 在系统关闭前从运行中的系统采集证据 |
| **证据监管链(Chain of Custody)** | 跟踪证据从采集到法庭全程处理过程的文档 |
| **取证可靠性(Forensic Soundness)** | 确保证据采集过程不改变原始证据 |
| **可信工具(Trusted Tools)** | 从外部介质使用已验证工具,而非受攻陷系统上的工具 |
| **证据完整性(Evidence Integrity)** | 采集后立即对所有证据计算 SHA256 哈希 |
| **洛卡德交换原则(Locard's Exchange Principle)** | 每次接触都留下痕迹 - 尽量减少调查人员的操作痕迹 |

## 工具与系统

| 工具 | 用途 |
|------|------|
| WinPmem | Windows 内存采集 |
| LiME(Linux Memory Extractor) | Linux 内核内存采集 |
| Sysinternals Suite | 进程、句柄和 DLL 分析(Windows) |
| Velociraptor | 大规模远程取证采集 |
| KAPE(Kroll Artifact Parser) | Windows 自动化产物采集 |
| CyLR | 跨平台实时响应采集 |
| GRR Rapid Response | 远程实时取证框架 |

## 常见场景

1. **无文件恶意软件攻击**:基于 PowerShell 的攻击,磁盘上无文件。内存转储是包含恶意脚本的关键证据。
2. **活跃 C2 会话**:攻击者建立实时连接。网络连接和进程数据揭示 C2 基础设施。
3. **内部人员数据窃取**:员工复制文件。进程列表、映射驱动器和网络连接显示外泄活动。
4. **受攻陷的 Web 服务器**:检测到 Web Shell。内存中可能包含尚未写入磁盘的额外后门。
5. **横向移动进行中**:攻击者在系统间移动。内存中的认证令牌和网络会话揭示影响范围。

## 输出格式

- 内存转储文件(.raw 或 .lime 格式)及 SHA256 哈希
- 网络状态捕获(连接、ARP、DNS、路由)
- 带命令行和父进程的进程列表
- 用户会话和认证数据
- 系统配置快照
- 含 SHA256 校验和的证据清单
- 证据监管链文档

Related Skills

testing-for-host-header-injection

9
from killvxk/cybersecurity-skills-zh

测试 Web 应用程序的 HTTP Host 头部注入漏洞,以识别密码重置中毒、Web 缓存投毒、SSRF 以及虚拟主机路由操控风险。

detecting-compromised-cloud-credentials

9
from killvxk/cybersecurity-skills-zh

通过分析异常 API 活动、不可能旅行模式、未授权资源配置以及凭据滥用指标,使用 GuardDuty、Defender for Identity 和 SCC 事件威胁检测,检测 AWS、Azure 和 GCP 中被盗用的云凭据。

configuring-host-based-intrusion-detection

9
from killvxk/cybersecurity-skills-zh

配置基于主机的入侵检测系统(HIDS)以监控端点文件完整性、系统调用和配置变更, 用于检测安全违规行为。适用于部署 OSSEC、Wazuh 或 AIDE 进行端点监控、构建文件完整性监控(FIM) 策略,或满足变更检测合规要求的场景。

collecting-threat-intelligence-with-misp

9
from killvxk/cybersecurity-skills-zh

MISP(恶意软件信息共享平台)是一个开源威胁情报平台,用于收集、共享、存储和关联定向攻击的失陷指标(IOC)、威胁情报、金融欺诈信息、漏洞信息或反恐信息。

collecting-open-source-intelligence

9
from killvxk/cybersecurity-skills-zh

使用公开可用的数据源、被动侦察工具和暗网监控,收集并综合关于威胁行为者、恶意基础设施和攻击活动的开源情报(OSINT)。适用于调查外部威胁行为者基础设施、为授权红队评估执行预参与侦察,或使用公开对手上下文丰富 CTI 报告。适用于涉及 Maltego、Shodan、OSINT framework、SpiderFoot 或基础设施侦察的请求。

collecting-indicators-of-compromise

9
from killvxk/cybersecurity-skills-zh

在安全事件期间和之后,系统性地收集、分类和分发失陷指标(Indicators of Compromise,IOC),以支持检测、阻断和威胁情报共享。涵盖网络、主机、邮件和行为指标,使用 STIX/TAXII 格式和威胁情报平台。适用于 IOC 收集、指标提取、威胁指标共享、失陷指标、STIX 导出或 IOC 情报丰富化相关请求。

analyzing-campaign-attribution-evidence

9
from killvxk/cybersecurity-skills-zh

攻击活动溯源归因分析涉及系统性地评估证据,以确定哪个威胁行为者或组织对某次网络行动负责。本技能涵盖使用 Diamond Model 和 ACH(竞争假设分析)收集并加权溯源归因指标、分析基础设施重叠、TTP 一致性、恶意软件代码相似性、操作时序模式和语言痕迹,以构建置信度加权的溯源归因评估。

triaging-vulnerabilities-with-ssvc-framework

9
from killvxk/cybersecurity-skills-zh

使用 CISA 的利益相关方特定漏洞分类(SSVC)决策树框架对漏洞进行分类和优先排序,产出可操作的修复优先级:Track、Track*、Attend 或 Act。

triaging-security-incident

9
from killvxk/cybersecurity-skills-zh

使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初始分类,确定严重性、范围和所需响应行动。 按类型对事件分类,根据业务影响分配优先级,并路由到相应的响应团队。适用于事件分类、 安全告警分类、严重性评估、事件优先级排序或初始事件分析等请求场景。

triaging-security-incident-with-ir-playbook

9
from killvxk/cybersecurity-skills-zh

使用结构化 IR Playbook 对安全事件进行分类和优先排序,确定严重性、分配响应团队并启动适当的响应程序。

triaging-security-alerts-in-splunk

9
from killvxk/cybersecurity-skills-zh

在 Splunk Enterprise Security 中对安全告警进行分类,通过 SPL 查询和事件审查(Incident Review) 仪表板对重要事件进行严重性分类、调查、关联相关遥测并做出升级或关闭决策。 适用于 SOC 分析师需要处理关联搜索产生的告警队列、确定调查优先级, 或需要为交接给二/三级分析师记录分类决策时。

tracking-threat-actor-infrastructure

9
from killvxk/cybersecurity-skills-zh

威胁行为者基础设施追踪涉及使用被动 DNS、证书透明度日志、Shodan/Censys 扫描、WHOIS 分析和网络指纹技术,对对手控制的 C2 服务器、钓鱼域名和暂存服务器等资产进行监控、映射和持续追踪