detecting-rootkit-activity

通过识别隐藏进程、被钩挂的系统调用、被修改的内核结构、隐藏文件和隐蔽网络连接, 检测受攻陷系统上的 Rootkit 存在情况,使用内存取证、交叉视图检测和完整性校验技术。 适用于 Rootkit 检测、隐藏进程发现、内核完整性校验或系统调用钩挂分析等请求场景。

9 stars

Best use case

detecting-rootkit-activity is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

通过识别隐藏进程、被钩挂的系统调用、被修改的内核结构、隐藏文件和隐蔽网络连接, 检测受攻陷系统上的 Rootkit 存在情况,使用内存取证、交叉视图检测和完整性校验技术。 适用于 Rootkit 检测、隐藏进程发现、内核完整性校验或系统调用钩挂分析等请求场景。

Teams using detecting-rootkit-activity 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/detecting-rootkit-activity/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/detecting-rootkit-activity/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/detecting-rootkit-activity/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How detecting-rootkit-activity Compares

Feature / Agentdetecting-rootkit-activityStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

通过识别隐藏进程、被钩挂的系统调用、被修改的内核结构、隐藏文件和隐蔽网络连接, 检测受攻陷系统上的 Rootkit 存在情况,使用内存取证、交叉视图检测和完整性校验技术。 适用于 Rootkit 检测、隐藏进程发现、内核完整性校验或系统调用钩挂分析等请求场景。

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

# 检测 Rootkit 活动

## 适用场景

- 系统出现入侵迹象,但标准工具(任务管理器、netstat)未显示异常
- 防病毒/EDR 检测到 Rootkit 签名,但无法识别具体的隐藏机制
- 内存取证发现内核数据结构与用户态工具输出之间存在差异
- 调查能在修复尝试和系统重启后存活的持久性威胁
- 在疑似内核级别失陷后验证系统完整性

**不适用**于作为一线检测方法;应先进行标准恶意软件分类,当怀疑存在隐藏行为时再升级为 Rootkit 分析。

## 前置条件

- Volatility 3,用于内存取证和内核结构分析
- GMER 或 Rootkit Revealer(Windows),用于实时系统扫描
- rkhunter 和 chkrootkit(Linux),用于文件系统和进程完整性检查
- Sysinternals 工具(Process Explorer、Autoruns、RootkitRevealer),用于 Windows 分析
- 来自被怀疑系统的内存转储(WinPmem、LiME)
- 用于对比的干净操作系统基线(已知正常的内核模块哈希)

## 工作流程

### 步骤 1:针对隐藏进程进行交叉视图检测

比较来自不同数据源的进程列表以发现差异:

```bash
# Volatility:比较进程枚举方法
# pslist - 遍历 ActiveProcessLinks(EPROCESS 链表,Rootkit 操纵的目标)
vol3 -f memory.dmp windows.pslist > pslist_output.txt

# psscan - 扫描物理内存中的 EPROCESS 池标签(具有 Rootkit 抵抗性)
vol3 -f memory.dmp windows.psscan > psscan_output.txt

# 比较输出以发现隐藏进程
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:检测系统调用钩挂

识别系统服务描述符表(SSDT)和导入地址表(IAT)中的钩子:

```bash
# 检查 SSDT 中被钩挂的系统调用
vol3 -f memory.dmp windows.ssdt

# 识别指向 ntoskrnl.exe 或 win32k.sys 之外的钩子
vol3 -f memory.dmp windows.ssdt | grep -v "ntoskrnl\|win32k"

# 检查内联钩子(绕道修补)
vol3 -f memory.dmp windows.apihooks --pid 4  # System 进程

# IDT(中断描述符表)分析
vol3 -f memory.dmp windows.idt

# 检查驱动程序上的 IRP(I/O 请求包)钩挂
vol3 -f memory.dmp windows.driverscan
vol3 -f memory.dmp windows.driverirp
```

```
Rootkit 钩挂类型:
━━━━━━━━━━━━━━━━━━━━━
SSDT 钩挂:    修改系统服务描述符表条目,将系统调用重定向
               至 Rootkit 代码(过滤进程/文件列表)

IAT 钩挂:     修补进程的导入地址表,在 API 调用到达内核
               之前拦截它们

内联钩挂:     用跳转指令覆写函数开头的字节,跳转至 Rootkit
               代码(绕道/跳板技术)

IRP 钩挂:     在驱动层拦截 I/O 请求包,过滤磁盘/网络操作

DKOM:         直接内核对象操控——无需钩挂即可解除
               EPROCESS 等结构的链接
```

### 步骤 3:分析内核模块和驱动

识别可能是 Rootkit 组件的未授权内核驱动:

```bash
# 列出所有已加载的内核模块
vol3 -f memory.dmp windows.modules

# 扫描内存中的驱动(包括隐藏/已解链的驱动)
vol3 -f memory.dmp windows.driverscan

# 比较模块列表以发现隐藏驱动
vol3 -f memory.dmp windows.modscan > modscan.txt
vol3 -f memory.dmp windows.modules > modules.txt

# 检查驱动签名并与已知正常基线进行验证
vol3 -f memory.dmp windows.verinfo

# 转储可疑驱动以进行静态分析
vol3 -f memory.dmp windows.moddump --base 0xFFFFF80012340000 --dump
```

### 步骤 4:检测文件和注册表隐藏

识别被 Rootkit 隐藏的文件和注册表键:

```bash
# Linux Rootkit 检测(使用 rkhunter)
rkhunter --check --skip-keypress --report-warnings-only

# chkrootkit 扫描
chkrootkit -q

# Windows:比较文件系统视图
# 实时系统文件列表 vs Volatility filescan
vol3 -f memory.dmp windows.filescan > mem_files.txt

# 检查隐藏的注册表键
vol3 -f memory.dmp windows.registry.hivelist
vol3 -f memory.dmp windows.registry.printkey --key "SYSTEM\CurrentControlSet\Services"

# 查找隐藏服务(已加载但不在服务注册表中)
vol3 -f memory.dmp windows.svcscan | grep -i "kernel"
```

### 步骤 5:网络连接分析

发现隐藏的网络连接和后门:

```bash
# 基于内存的网络连接枚举
vol3 -f memory.dmp windows.netscan

# 与实时 netstat 对比(如可用)以发现隐藏连接
# 隐藏连接:存在于内存中但不被 netstat 显示

# 查找原始套接字(Rootkit 常用于隐蔽通信)
vol3 -f memory.dmp windows.netscan | grep RAW

# 检查网络过滤驱动(NDIS 钩挂)
vol3 -f memory.dmp windows.driverscan | grep -i "ndis\|tcpip\|afd"

# 分析驱动注册的回调例程
vol3 -f memory.dmp windows.callbacks
```

### 步骤 6:完整性验证

验证系统文件和内核完整性:

```bash
# 检查内核代码完整性(对比内存中的内核与磁盘副本)
vol3 -f memory.dmp windows.moddump --base 0xFFFFF80070000000 --dump
# 比较转储的 ntoskrnl.exe 的 SHA-256 与已知正常副本

# Windows:系统文件检查器(在实时系统上)
sfc /scannow

# Linux:软件包完整性验证
rpm -Va  # 基于 RPM 的系统
debsums -c  # 基于 Debian 的系统

# 对比关键系统二进制文件
find /bin /sbin /usr/bin /usr/sbin -type f -exec sha256sum {} \; > current_hashes.txt
# 与基线对比:diff baseline_hashes.txt current_hashes.txt

# 使用 YARA 扫描已知 Rootkit 签名
vol3 -f memory.dmp yarascan.YaraScan --yara-file rootkit_rules.yar
```

## 核心概念

| 术语 | 定义 |
|------|------|
| **Rootkit** | 旨在维持持久特权访问同时对系统管理员和安全工具隐藏自身存在的恶意软件 |
| **DKOM** | 直接内核对象操控;通过修改内核数据结构(如解除 EPROCESS 链接)来隐藏对象而无需钩挂 |
| **SSDT 钩挂** | 替换系统服务描述符表中的条目以拦截和过滤系统调用结果(隐藏进程、文件、连接) |
| **内联钩挂** | 用跳转到 Rootkit 代码的指令修补函数的起始指令;Rootkit 可以在返回之前过滤函数输出 |
| **交叉视图检测** | 比较多种枚举方法的结果(链表遍历 vs 内存扫描)以识别因隐藏而产生的差异 |
| **内核驱动** | 在内核态(Ring 0)运行、具有完整系统访问权限的代码;Rootkit 使用恶意驱动获得内核级控制权 |
| **Bootkit** | 感染启动过程(MBR、VBR 或 UEFI 固件)以在操作系统和安全工具之前加载的 Rootkit |

## 工具与系统

- **Volatility**:内存取证框架,提供交叉视图检测、SSDT 分析和内核结构检查以用于 Rootkit 检测
- **GMER**:免费的 Windows Rootkit 检测工具,扫描 SSDT 钩子、IDT 钩子、IRP 钩子及隐藏的进程/文件/注册表
- **rkhunter**:Linux Rootkit 检测工具,检查已知 Rootkit 签名、可疑文件和系统二进制文件修改
- **chkrootkit**:通过基于签名和基于异常的检测来检测 Rootkit 存在的 Linux 工具
- **Sysinternals RootkitRevealer**:微软工具,通过比较 Windows API 结果与原始文件系统/注册表扫描来发现差异

## 常见场景

### 场景:调查标准工具显示无入侵的系统

**背景**:防火墙日志显示终端向已知 C2 IP 发出信标,但本地 EDR、任务管理器和 netstat 未显示任何可疑进程或连接。已获取内存转储进行分析。

**方法**:
1. 运行 Volatility `psscan` 并与 `pslist` 对比,识别通过 DKOM 隐藏的进程
2. 运行 `windows.ssdt` 检查过滤进程和网络列表的系统调用钩子
3. 运行 `windows.malfind` 检测合法进程中的注入代码
4. 运行 `windows.netscan` 发现对用户态工具隐藏的网络连接
5. 运行 `windows.driverscan` 识别启用隐藏的恶意内核驱动
6. 转储 Rootkit 驱动并使用 Ghidra 分析其钩挂机制
7. 检查启动持久化(MBR/VBR 修改、UEFI 固件植入)

**注意事项**:
- 不要在已受攻陷的实时系统上运行检测工具(Rootkit 可能对其隐藏或颠覆)
- 不要因未发现 SSDT 钩子就假设内核完整(Rootkit 可能使用 DKOM 或内联钩子)
- 不要只检查用户态或内核态 Rootkit 组件(许多 Rootkit 两者兼有)
- 不要相信在实时系统上运行的 Rootkit 扫描器结果;务必通过离线内存取证进行验证

## 输出格式

```
ROOTKIT 检测分析报告
====================================
转储文件:      memory.dmp
系统:          Windows 10 21H2 x64
分析工具:      Volatility 3.2

交叉视图检测
进程列表对比:
  pslist 进程数:  127
  psscan 进程数:  129
  [!] 隐藏进程:2 个
    PID 6784:sysmon64.exe(隐藏的 Rootkit 组件)
    PID 6812:netfilter.exe(隐藏的网络过滤器)

SSDT 钩挂分析
[!] 条目 0x004A(NtQuerySystemInformation)被钩挂 -> driver.sys+0x1200
[!] 条目 0x0055(NtQueryDirectoryFile)被钩挂 -> driver.sys+0x1400
[!] 条目 0x0119(NtDeviceIoControlFile)被钩挂 -> driver.sys+0x1600
钩挂目标:driver.sys 位于 0xFFFFF800ABCD0000(未签名,可疑)

内核驱动分析
[!] driver.sys - 无数字签名,加载于 0xFFFFF800ABCD0000
    大小:45,056 字节
    SHA-256:abc123def456...
    IRP 钩挂:IRP_MJ_CREATE, IRP_MJ_DEVICE_CONTROL
    注册表:HKLM\SYSTEM\CurrentControlSet\Services\MalDriver

隐藏网络连接
PID 6812:10.1.5.42:49152 -> 185.220.101.42:443(ESTABLISHED)
  - 无法通过 netstat 或用户态工具看到
  - 被 NtDeviceIoControlFile SSDT 钩子过滤

ROOTKIT 功能
- 进程隐藏(DKOM + SSDT)
- 文件隐藏(NtQueryDirectoryFile 钩子)
- 网络连接隐藏(NtDeviceIoControlFile 钩子)
- 内核态持久化(驱动服务)

修复措施
- 从干净介质启动进行离线修复
- 从离线注册表中移除恶意驱动
- 验证 MBR/VBR/UEFI 完整性以排查启动持久化
- 对于内核级别的入侵建议完整重建系统
```

Related Skills

hunting-for-webshell-activity

9
from killvxk/cybersecurity-skills-zh

通过分析 Web 目录中的文件创建行为、Web 服务器异常进程派生以及异常 HTTP 模式,狩猎面向互联网服务器上的 Webshell 部署。

detecting-wmi-persistence

9
from killvxk/cybersecurity-skills-zh

通过分析 Sysmon 事件 ID 19、20 和 21 中的恶意 EventFilter、EventConsumer 和 FilterToConsumerBinding 创建,检测 WMI 事件订阅持久化。

detecting-t1548-abuse-elevation-control-mechanism

9
from killvxk/cybersecurity-skills-zh

通过监控注册表修改、进程提升标志和异常的父子进程关系,检测提升控制机制滥用,包括 UAC 绕过、sudo 利用和 setuid/setgid 操纵。

detecting-t1055-process-injection-with-sysmon

9
from killvxk/cybersecurity-skills-zh

通过分析 Sysmon 事件中的跨进程内存操作、远程线程创建和异常 DLL 加载模式,检测进程注入技术(T1055),包括经典 DLL 注入、进程镂空和 APC 注入。

detecting-t1003-credential-dumping-with-edr

9
from killvxk/cybersecurity-skills-zh

利用 EDR 遥测数据、Sysmon 进程访问监控和 Windows 安全事件关联,检测针对 LSASS 内存、SAM 数据库、NTDS.dit 和缓存凭据的 OS 凭据转储技术。

detecting-suspicious-powershell-execution

9
from killvxk/cybersecurity-skills-zh

检测可疑的 PowerShell 执行模式,包括编码命令、下载器(download cradles)、AMSI 绕过尝试以及受限语言模式规避。

detecting-suspicious-oauth-application-consent

9
from killvxk/cybersecurity-skills-zh

使用 Microsoft Graph API、审计日志和权限分析,检测 Azure AD / Microsoft Entra ID 中的高风险 OAuth 应用授权同意,识别非法同意授权攻击。

detecting-supply-chain-attacks-in-ci-cd

9
from killvxk/cybersecurity-skills-zh

扫描 GitHub Actions 工作流和 CI/CD 流水线配置,检测供应链攻击(Supply Chain Attack)向量, 包括未固定的 Action 版本、通过表达式的脚本注入、依赖混淆(Dependency Confusion)和密钥泄露。 使用 PyGithub 和 YAML 解析进行自动化审计。适用于加固 CI/CD 流水线或调查被攻击的构建系统。

detecting-stuxnet-style-attacks

9
from killvxk/cybersecurity-skills-zh

本技能涵盖检测遵循Stuxnet攻击模式的复杂网络物理攻击——在修改PLC逻辑的同时欺骗传感器读数以向操作员隐藏操控行为。内容涉及PLC逻辑完整性监控、基于物理的过程异常检测、工程师工作站入侵指标、USB传播攻击向量,以及从IT到OT横向移动直至过程操控的多阶段攻击链检测。

detecting-sql-injection-via-waf-logs

9
from killvxk/cybersecurity-skills-zh

分析 WAF(Web 应用防火墙,ModSecurity/AWS WAF/Cloudflare)日志,检测 SQL 注入(SQL Injection)攻击活动。 解析 ModSecurity 审计日志和 JSON WAF 事件日志,识别 SQLi 模式(UNION SELECT、OR 1=1、SLEEP()、BENCHMARK()), 追踪攻击源,关联多阶段注入尝试,并生成带 OWASP 分类的事件报告。

detecting-spearphishing-with-email-gateway

9
from killvxk/cybersecurity-skills-zh

鱼叉式网络钓鱼(Spearphishing)使用个性化、经过研究的内容针对特定个人,可绕过通用垃圾邮件过滤器。邮件安全网关(SEG)如 Microsoft Defender for Office 365、Proofpoint、Mimecast 和 Barracuda 提供高级检测能力,包括行为分析、URL 引爆、附件沙箱和冒充检测。本技能涵盖配置这些网关以检测和拦截定向钓鱼攻击。

detecting-shadow-it-cloud-usage

9
from killvxk/cybersecurity-skills-zh

通过使用 Python pandas 分析代理日志、DNS 查询日志和网络流数据,进行流量模式分析和域名分类,检测未授权的 SaaS 和云服务使用(影子 IT)。