关于 detecting-rootkit-activity
面向安全分析人员的 rootkit 检测技能,指导通过内存取证和多视图比对识别被隐藏的进程、驱动与连接,并检查内核完整性。
主要功能
- 01跨视图比对进程列表
- 02检测系统调用与 API 钩子
- 03分析隐藏的内核驱动
- 04检查文件、注册表与网络隐藏
- 05验证内核和系统文件完整性
适用场景
- 01排查常规工具未发现的入侵迹象
- 02分析内存转储中的隐藏进程与驱动
- 03验证疑似内核级入侵后的系统完整性
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill detecting-rootkit-activity安装后在 Claude Code 中输入/detecting-rootkit-activity确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
LICENSEreferences/api-reference.mdscripts/agent.py详细介绍
检测 Rootkit 活动
何时使用
- 系统显示出失陷迹象,但标准工具(任务管理器、netstat)未显示任何异常
- 杀毒软件/EDR 检测到 rootkit 特征,但无法识别具体的隐藏机制
- 内存取证发现内核数据结构与用户态工具输出之间存在差异
- 调查在修复尝试和系统重启后仍能存活的持续性威胁
- 在内核级失陷疑似发生后验证系统完整性
不要将其作为一线检测方法;先从标准恶意软件排查开始,当怀疑存在隐藏行为时再升级到 rootkit 分析。
前提条件
- 用于内存取证和内核结构分析的 Volatility 3
- 用于实时系统扫描的 GMER 或 Rootkit Revealer(Windows)
- 用于文件系统和进程完整性检查的 rkhunter 和 chkrootkit(Linux)
- 用于 Windows 分析的 Sysinternals 工具(Process Explorer、Autoruns、RootkitRevealer)
- 来自可疑系统的内存转储(WinPmem、LiME)
- 用于比较的干净操作系统基线(已知良好的内核模块哈希)
工作流
第 1 步:针对隐藏进程的交叉视图检测
比较来自不同数据源的进程列表,以发现差异:
# Volatility: Compare process enumeration methods
# pslist - walks ActiveProcessLinks (EPROCESS linked list - what rootkits manipulate)
vol3 -f memory.dmp windows.pslist > pslist_output.txt
# psscan - scans physical memory for EPROCESS pool tags (rootkit-resistant)
vol3 -f memory.dmp windows.psscan > psscan_output.txt
# Compare outputs to find hidden processes
python3 << 'PYEOF'
pslist_pids = set()
psscan_pids = set()
with open("pslist_output.txt") as f:
for line in f:
parts = line.split()
if len(parts) > 1 and parts[1].isdigit():
pslist_pids.add(int(parts[1]))
with open("psscan_output.txt") as f:
for line in f:
parts = line.split()
if len(parts) > 1 and parts[1].isdigit():
psscan_pids.add(int(parts[1]))
hidden = psscan_pids - pslist_pids
if hidden:
print(f"[!] HIDDEN PROCESSES DETECTED (in psscan but not pslist):")
for pid in hidden:
print(f" PID: {pid}")
else:
print("[*] No hidden processes detected via cross-view analysis")
PYEOF
第 2 步:检测系统调用 Hook
识别系统服务描述符表(SSDT)和导入地址表中的 hook:
# Check SSDT for hooked system calls
vol3 -f memory.dmp windows.ssdt
# Identify hooks pointing outside ntoskrnl.exe or win32k.sys
vol3 -f memory.dmp windows.ssdt | grep -v "ntoskrnl\|win32k"
# Check for Inline hooks (detour patching)
vol3 -f memory.dmp windows.apihooks --pid 4 # System process
# IDT (Interrupt Descriptor Table) analysis
vol3 -f memory.dmp windows.idt
# Check for IRP (I/O Request Packet) hooking on drivers
vol3 -f memory.dmp windows.driverscan
vol3 -f memory.dmp windows.driverirp
Types of Rootkit Hooks:
━━━━━━━━━━━━━━━━━━━━━
SSDT Hook: Modifies System Service Descriptor Table entries to redirect
system calls through rootkit code (filters process/file listings)
IAT Hook: Patches Import Address Table of a process to intercept API calls
before they reach the kernel
Inline Hook: Overwrites the first bytes of a function with a JMP to rootkit code
(detour/trampoline technique)
IRP Hook: Intercepts I/O Request Packets to filter disk/network operations
at the driver level
DKOM: Direct Kernel Object Manipulation - unlinking structures like
EPROCESS from the ActiveProcessLinks list without hooking
第 3 步:分析内核模块和驱动程序
识别可能是 rootkit 组件的未授权内核驱动程序:
# List all loaded kernel modules
vol3 -f memory.dmp windows.modules
# Scan for drivers in memory (including hidden/unlinked)
vol3 -f memory.dmp windows.driverscan
# Compare module lists to find hidden drivers
vol3 -f memory.dmp windows.modscan > modscan.txt
vol3 -f memory.dmp windows.modules > modules.txt
# Check driver signatures and verify against known-good baselines
vol3 -f memory.dmp windows.verinfo
# Dump suspicious driver for static analysis
vol3 -f memory.dmp windows.moddump --base 0xFFFFF80012340000 --dump
第 4 步:检测文件和注册表隐藏
识别被 rootkit 隐藏的文件和注册表项:
# Linux rootkit detection with rkhunter
rkhunter --check --skip-keypress --report-warnings-only
# chkrootkit scanning
chkrootkit -q
# Windows: Compare filesystem views
# Live system file listing vs Volatility filescan
vol3 -f memory.dmp windows.filescan > mem_files.txt
# Check for hidden registry keys
vol3 -f memory.dmp windows.registry.hivelist
vol3 -f memory.dmp windows.registry.printkey --key "SYSTEM\CurrentControlSet\Services"
# Look for hidden services (loaded but not in service registry)
vol3 -f memory.dmp windows.svcscan | grep -i "kernel"
第 5 步:网络连接分析
查找隐藏的网络连接和后门:
# Memory-based network connection enumeration
vol3 -f memory.dmp windows.netscan
# Compare with live netstat (if available) to find hidden connections
# Hidden connections: present in memory but not shown by netstat
# Look for raw sockets (often used by rootkits for covert communication)
vol3 -f memory.dmp windows.netscan | grep RAW
# Check for network filter drivers (NDIS hooks)
vol3 -f memory.dmp windows.driverscan | grep -i "ndis\|tcpip\|afd"
# Analyze callback routines registered by drivers
vol3 -f memory.dmp windows.callbacks
第 6 步:完整性验证
验证系统文件和内核完整性:
# Check kernel code integrity (compare in-memory kernel to on-disk copy)
vol3 -f memory.dmp windows.moddump --base 0xFFFFF80070000000 --dump
# Compare SHA-256 of dumped ntoskrnl.exe with known-good copy
# Windows: System File Checker (on live system)
sfc /scannow
# Linux: Package integrity verification
rpm -Va # RPM-based systems
debsums -c # Debian-based systems
# Compare critical system binaries
find /bin /sbin /usr/bin /usr/sbin -type f -exec sha256sum {} \; > current_hashes.txt
# Compare against baseline: diff baseline_hashes.txt current_hashes.txt
# YARA scan for known rootkit signatures
vol3 -f memory.dmp yarascan.YaraScan --yara-file rootkit_rules.yar
关键概念
| 术语 | 定义 |
|---|---|
| Rootkit | 一种恶意软件,旨在维持持久、特权访问,同时向系统管理员和安全工具隐藏其存在 |
| DKOM | 直接内核对象操作;通过修改内核数据结构(例如取消链接 EPROCESS)来隐藏对象而无需 hook 的技术 |
| SSDT Hooking | 替换系统服务描述符表中的条目,以拦截和过滤系统调用结果(隐藏进程、文件、连接) |
| Inline Hooking | 用跳转到 rootkit 代码的指令修补函数的前几条指令;rootkit 可在返回前过滤函数输出 |
| 交叉视图检测 | 比较多种枚举方法(链表遍历与内存扫描)的结果,以识别由隐藏造成的差异 |
| 内核驱动程序 | 在内核模式(Ring 0)下运行且拥有完整系统访问权限的代码;rootkit 利用恶意驱动程序获得内核级控制 |
| Bootkit | 感染启动过程(MBR、VBR 或 UEFI 固件)的 rootkit,使其在操作系统和安全工具之前加载 |
工具与系统
- Volatility:内存取证框架,为 rootkit 检测提供交叉视图检测、SSDT 分析和内核结构检查
- GMER:免费的 Windows rootkit 检测工具,可扫描 SSDT hook、IDT hook、IRP hook 以及隐藏的进程/文件/注册表
- rkhunter:Linux rootkit 检测工具,用于检查已知 rootkit 特征、可疑文件和系统二进制文件修改
- chkrootkit:Linux 工具,通过基于特征和基于异常的检查来检测 rootkit 的存在
- Sysinternals RootkitRevealer:Microsoft 工具,将 Windows API 结果与原始文件系统/注册表扫描进行比较,以发现差异
常见场景
场景:调查标准工具未显示任何失陷迹象的系统
背景:防火墙日志显示某端点正向已知 C2 IP 发起网络信标,但本地 EDR、任务管理器和 netstat 均未显示任何可疑进程或连接。已获取内存转储用于分析。
方法:
- 运行 Volatility
psscan并与pslist对比,识别通过 DKOM 隐藏的进程 - 运行
windows.ssdt检查是否存在过滤进程和网络列表的系统调用钩子 - 运行
windows.malfind检测合法进程中注入的代码 - 运行
windows.netscan查找对用户态工具隐藏的网络连接 - 运行
windows.driverscan识别实现隐藏的恶意内核驱动 - 转储 rootkit 驱动并用 Ghidra 分析,以理解其挂钩机制
- 检查引导持久化(MBR/VBR 修改、UEFI 固件植入)
陷阱:
- 在受陷的实时系统上运行检测工具(rootkit 可能对其隐藏或进行破坏)
- 因为没有发现 SSDT 钩子就假定内核完整(rootkit 可能改用 DKOM 或内联钩子)
- 未同时检查用户态和内核态 rootkit 组件(许多 rootkit 两者兼备)
- 在实时系统上轻信 rootkit 扫描器结果;务必用离线内存取证进行验证
输出格式
ROOTKIT DETECTION ANALYSIS REPORT
====================================
Dump File: memory.dmp
System: Windows 10 21H2 x64
Analysis Tool: Volatility 3.2
CROSS-VIEW DETECTION
Process List Comparison:
pslist processes: 127
psscan processes: 129
[!] HIDDEN PROCESSES: 2
PID 6784: sysmon64.exe (hidden rootkit component)
PID 6812: netfilter.exe (hidden network filter)
SSDT HOOK ANALYSIS
[!] Entry 0x004A (NtQuerySystemInformation) hooked -> driver.sys+0x1200
[!] Entry 0x0055 (NtQueryDirectoryFile) hooked -> driver.sys+0x1400
[!] Entry 0x0119 (NtDeviceIoControlFile) hooked -> driver.sys+0x1600
Hook Target: driver.sys at 0xFFFFF800ABCD0000 (unsigned, suspicious)
KERNEL DRIVER ANALYSIS
[!] driver.sys - No digital signature, loaded at 0xFFFFF800ABCD0000
Size: 45,056 bytes
SHA-256: abc123def456...
IRP Hooks: IRP_MJ_CREATE, IRP_MJ_DEVICE_CONTROL
Registry: HKLM\SYSTEM\CurrentControlSet\Services\MalDriver
HIDDEN NETWORK CONNECTIONS
PID 6812: 10.1.5.42:49152 -> 185.220.101.42:443 (ESTABLISHED)
- Not visible via netstat or user-mode tools
- Filtered by NtDeviceIoControlFile SSDT hook
ROOTKIT CAPABILITIES
- Process hiding (DKOM + SSDT)
- File hiding (NtQueryDirectoryFile hook)
- Network connection hiding (NtDeviceIoControlFile hook)
- Kernel-mode persistence (driver service)
REMEDIATION
- Boot from clean media for offline remediation
- Remove malicious driver from offline registry
- Verify MBR/VBR/UEFI integrity for boot persistence
- Full system rebuild recommended for kernel-level compromise
评论
支持 Markdown