Communitygithub.com

分析Linux内核Rootkit

使用Volatility3在Linux内存转储中检测内核级Rootkit

分析Linux内核Rootkit 是什么?

这项技能主要用于通过内存取证和交叉视图分析技术检测Linux内核Rootkit。它详细说明了如何使用Volatility3的Linux插件(如linux.check_syscall、linux.lsmod等)检查系统调用表挂钩、隐藏的内核模块和修改过的函数指针。同时结合rkhunter和chkrootkit进行实时系统扫描,以识别已知Rootkit签名、可疑文件和篡改的系统二进制文件。该技能适用于安全事件响应、威胁狩猎规则构建以及SOC分析师需要结构化分析流程的场景。它支持物理内存转储(通过LiME或AVML获取)和实时系统检查,并提供可操作的JSON报告输出,帮助快速定位隐藏进程、网络连接和内核级后门。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-linux-kernel-rootkits

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

分析Linux内核Rootkit 是做什么的?

概述

Linux内核Rootkit在ring 0层级运行,通过修改内核数据结构来隐藏进程、文件、网络连接和内核模块,从而逃避用户空间工具的检测。检测方法包括内存取证(使用Volatility3分析物理内存转储)和交叉视图分析(比较/proc、/sys和内核数据结构之间的不一致性)。本技能涵盖如何使用Volatility3 Linux插件检测系统调用表挂钩、隐藏的内核模块和修改过的函数指针,并辅以使用rkhunter和chkrootkit进行实时系统扫描。

何时使用

  • 调查需要分析Linux内核Rootkit的安全事件时
  • 为此领域构建检测规则或威胁狩猎查询时
  • SOC分析师需要针对此类分析的结构化流程时
  • 验证相关攻击技术的安全监控覆盖范围时

前提条件

  • 已安装Volatility3(pip install volatility3)
  • Linux内存转储(通过LiME、AVML或/proc/kcore获取)
  • 与目标内核版本匹配的Volatility3 Linux符号表(ISF)
  • 用于实时系统扫描的rkhunter和chkrootkit工具
  • 用于对比的已知良好的内核映像

步骤

第1步:获取内存转储

使用LiME内核模块或AVML(云实例)捕获Linux物理内存。

第2步:使用Volatility3分析

运行linux.check_syscall、linux.lsmod、linux.hidden_modules和linux.check_idt插件以检测Rootkit构件。

第3步:交叉视图分析

比较来自/proc/modules、lsmod和/sys/module的模块列表,以识别在某个视图中隐藏但在另一个视图中存在的模块。

第4步:实时系统扫描

运行rkhunter和chkrootkit以检测已知的Rootkit签名、可疑文件和修改过的系统二进制文件。

预期输出

包含检测到的系统调用挂钩、隐藏的内核模块、修改过的IDT条目、可疑的/proc不一致性以及rkhunter发现的JSON报告。

示例输出

$ sudo python3 rootkit_analyzer.py --memory /evidence/linux-mem.lime --profile Ubuntu2204

Linux内核Rootkit分析报告
=====================================
内存映像: /evidence/linux-mem.lime
内核版本: 5.15.0-91-generic (Ubuntu 22.04 LTS)
分析时间: 2024-01-18 09:15:32 UTC

[+] 扫描系统调用表以查找挂钩...
    系统调用表基址: 0xffffffff82200300
    检查的系统调用总数: 449

    检测到被挂钩的系统调用:
    ┌─────────┬──────────────────┬──────────────────────┬──────────────────────┐
    │ NR      │ 系统调用         │ 预期地址             │ 当前地址             │
    ├─────────┼──────────────────┼──────────────────────┼──────────────────────┤
    │ 0       │ sys_read         │ 0xffffffff8139a0e0   │ 0xffffffffc0a12000   │
    │ 2       │ sys_open         │ 0xffffffff8139b340   │ 0xffffffffc0a12180   │
    │ 78      │ sys_getdents64   │ 0xffffffff813f5210   │ 0xffffffffc0a12300   │
    │ 62      │ sys_kill         │ 0xffffffff8110c4a0   │ 0xffffffffc0a12480   │
    └─────────┴──────────────────┴──────────────────────┴──────────────────────┘
    警告: 检测到4个系统调用挂钩 - 确认存在Rootkit行为

[+] 检查隐藏的内核模块...
    已加载的模块 (lsmod):         147
    kobject列表中的模块:        149
    隐藏的模块:
      - "netfilter_helper" at 0xffffffffc0a10000 (大小: 12288)
      - "kworker_sched"    at 0xffffffffc0a14000 (大小: 8192)

[+] 扫描/proc中的不一致性...
    task_struct列表中的进程: 234
    /proc中可见的进程:   231
    隐藏的进程:
      - PID 31337  命令: "[kworker/0:3]"   (伪装成内核线程)
      - PID 31442  命令: "rsyslogd"         (伪装的,真正的rsyslogd是PID 892)
      - PID 31500  命令: ""                 (未命名进程)

[+] 检查IDT条目...
    扫描的IDT条目: 256
    修改的条目: 0 (正常)

[+] 运行rkhunter扫描...
    检查已知Rootkit:        68个变种已检查
    Diamorphine rootkit:                警告 - 签名匹配
    系统二进制文件检查:
      /usr/bin/ps:     已修改 (SHA-256不匹配)
      /usr/bin/netstat: 已修改 (SHA-256不匹配)
      /usr/bin/ls:     已修改 (SHA-256不匹配)
      /usr/sbin/ss:    正常

[+] 网络分析...
    隐藏的连接 (不在/proc/net/tcp中):
      已建立  0.0.0.0:0 -> 198.51.100.47:4443 (PID 31337)
      已建立  0.0.0.0:0 -> 198.51.100.47:8080 (PID 31442)

总结:
  Rootkit类型:         可加载内核模块 (LKM)
  可能家族:            Diamorphine变种
  系统调用挂钩:        4个 (read, open, getdents64, kill)
  隐藏模块:            2个
  隐藏进程:            3个
  隐藏连接:            2个 (C2: 198.51.100.47)
  修改的二进制文件:    3个 (/usr/bin/ps, netstat, ls)
  风险等级:           严重

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,

相关技能