eradicating-malware-from-infected-systems

系统性地清除受感染系统中的恶意软件、后门和攻击者持久化机制,确保彻底根除并防止再次感染。

9 stars

Best use case

eradicating-malware-from-infected-systems is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

系统性地清除受感染系统中的恶意软件、后门和攻击者持久化机制,确保彻底根除并防止再次感染。

Teams using eradicating-malware-from-infected-systems 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/eradicating-malware-from-infected-systems/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/eradicating-malware-from-infected-systems/SKILL.md"

Manual Installation

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

How eradicating-malware-from-infected-systems Compares

Feature / Agenteradicating-malware-from-infected-systemsStandard 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

# 从受感染系统中根除恶意软件(Eradicating Malware from Infected Systems)

## 适用场景
- 已确认恶意软件感染且遏制措施已到位
- 取证调查已识别所有持久化机制
- 所有受攻陷系统已识别并确定范围
- 准备好清除攻击者产物并恢复干净状态
- 遏制后阶段需要进行系统性清理

## 前置条件
- 已完成取证分析,识别所有恶意软件产物
- 所有受攻陷系统和账号的清单
- 部署了具有最新签名的 EDR/AV
- 针对特定恶意软件家族的 YARA 规则
- 用于恢复的干净系统镜像或已验证的备份
- 根除期间网络隔离仍然有效

## 工作流程

### 步骤 1:映射所有持久化机制
```bash
# Windows - 检查所有已知的持久化位置
# Autoruns(Sysinternals)- 全面的自启动枚举
autorunsc.exe -accepteula -a * -c -h -s -v > autoruns_report.csv

# 注册表 Run 键
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /s
reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /s
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /s
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run" /s

# 计划任务
schtasks /query /fo CSV /v > schtasks_all.csv

# WMI 事件订阅
Get-WMIObject -Namespace root\Subscription -Class __EventFilter
Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding

# 服务
Get-Service | Where-Object {$_.Status -eq 'Running'} | Select-Object Name, DisplayName, BinaryPathName

# Linux 持久化
cat /etc/crontab
ls -la /etc/cron.*/
ls -la /etc/init.d/
systemctl list-unit-files --type=service | grep enabled
cat /etc/rc.local
ls -la ~/.bashrc ~/.profile ~/.bash_profile
```

### 步骤 2:识别所有恶意软件产物
```bash
# 使用针对特定恶意软件家族的 YARA 规则扫描
yara -r -s malware_rules/specific_family.yar C:\ 2>/dev/null

# 使用多个 AV 引擎扫描
# ClamAV 扫描
clamscan -r --infected --remove=no /mnt/infected_disk/

# 检查已知恶意文件哈希
find / -type f -newer /tmp/baseline_timestamp -exec sha256sum {} \; 2>/dev/null | \
  while read hash file; do
    grep -q "$hash" known_malicious_hashes.txt && echo "MALICIOUS: $file ($hash)"
  done

# 检查 Web Shell
find /var/www/ -name "*.php" -newer /tmp/baseline -exec grep -l "eval\|base64_decode\|system\|passthru\|shell_exec" {} \;

# 检查未授权的 SSH 密钥
find / -name "authorized_keys" -exec cat {} \; 2>/dev/null
```

### 步骤 3:清除恶意软件文件和产物
```bash
# 删除已识别的恶意文件(取证镜像后执行)
# Windows
Remove-Item -Path "C:\Windows\Temp\malware.exe" -Force
Remove-Item -Path "C:\Users\Public\backdoor.dll" -Force

# 删除恶意计划任务
schtasks /delete /tn "MaliciousTaskName" /f

# 删除 WMI 持久化
Get-WMIObject -Namespace root\Subscription -Class __EventFilter -Filter "Name='MalFilter'" | Remove-WMIObject
Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer -Filter "Name='MalConsumer'" | Remove-WMIObject

# 删除恶意注册表项
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "MalEntry" /f

# 删除恶意服务
sc stop "MalService" && sc delete "MalService"

# Linux - 删除恶意 cron 条目、二进制文件、SSH 密钥
crontab -r  # 删除整个 crontab(或编辑特定条目)
rm -f /tmp/.hidden_backdoor
sed -i '/malicious_key/d' ~/.ssh/authorized_keys
systemctl disable malicious-service && rm /etc/systemd/system/malicious-service.service
```

### 步骤 4:重置受攻陷凭据
```bash
# 重置所有受攻陷用户密码
Import-Module ActiveDirectory
Get-ADUser -Filter * -SearchBase "OU=CompromisedUsers,DC=domain,DC=com" |
  Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString "TempP@ss!$(Get-Random)" -AsPlainText -Force)

# 重置 KRBTGT 密码(两次,间隔 12 小时以上,用于黄金票据攻击后处置)
Reset-KrbtgtPassword -DomainController DC01
# 等待 12 小时以上,再次重置
Reset-KrbtgtPassword -DomainController DC01

# 轮换服务账号密码
Get-ADServiceAccount -Filter * | ForEach-Object {
  Reset-ADServiceAccountPassword -Identity $_.Name
}

# 撤销所有 Azure AD 令牌
Get-AzureADUser -All $true | ForEach-Object {
  Revoke-AzureADUserAllRefreshToken -ObjectId $_.ObjectId
}

# 轮换 API 密钥和 Secret
# 特定应用的凭据轮换
```

### 步骤 5:修补初始访问利用的漏洞
```bash
# 识别并修补入口点漏洞
# Windows Update
Install-WindowsUpdate -KBArticleID "KB5001234" -AcceptAll -AutoReboot

# Linux 补丁
apt update && apt upgrade -y  # Debian/Ubuntu
yum update -y                 # RHEL/CentOS

# 特定应用补丁
# 更新 Web 应用框架、CMS 等

# 验证补丁已应用
Get-HotFix -Id "KB5001234"
```

### 步骤 6:验证根除效果
```bash
# 使用更新签名进行全系统扫描
# CrowdStrike Falcon - 按需扫描
curl -X POST "https://api.crowdstrike.com/scanner/entities/scans/v1" \
  -H "Authorization: Bearer $FALCON_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ids": ["device_id"]}'

# 验证没有残留持久化机制
autorunsc.exe -accepteula -a * -c -h -s -v | findstr /i "unknown verified"

# 检查是否有残留可疑进程
Get-Process | Where-Object {$_.Path -notlike "C:\Windows\*" -and $_.Path -notlike "C:\Program Files*"}

# 验证没有未授权的网络连接
Get-NetTCPConnection -State Established |
  Where-Object {$_.RemoteAddress -notlike "10.*" -and $_.RemoteAddress -notlike "172.16.*"} |
  Select-Object LocalPort, RemoteAddress, RemotePort, OwningProcess

# 再次运行 YARA 规则确认没有产物残留
yara -r malware_rules/specific_family.yar C:\ 2>/dev/null
```

## 核心概念

| 概念 | 说明 |
|------|------|
| **持久化机制(Persistence Mechanism)** | 攻击者用于在系统重启后维持访问的方法 |
| **根因修复(Root Cause Remediation)** | 修复使初始攻陷成为可能的漏洞 |
| **凭据轮换(Credential Rotation)** | 重置所有可能受攻陷的密码和令牌 |
| **KRBTGT 重置** | 在黄金票据(Golden Ticket)攻击后使 Kerberos 票据失效 |
| **指标扫描(Indicator Sweep)** | 在所有系统上扫描已知的恶意产物 |
| **验证扫描(Validation Scan)** | 在恢复前确认根除成功 |
| **重镜像(Re-imaging)** | 从干净镜像重建系统而非进行清理 |

## 工具与系统

| 工具 | 用途 |
|------|------|
| Sysinternals Autoruns | 枚举所有 Windows 自启动位置 |
| YARA | 基于自定义规则的恶意软件扫描 |
| CrowdStrike/SentinelOne | 基于 EDR 的扫描和修复 |
| ClamAV | 开源防病毒扫描 |
| PowerShell | 脚本化清理与验证 |
| Velociraptor | 远程取证采集和修复 |

## 常见场景

1. **具有多重持久化的 RAT**:使用注册表、计划任务和 WMI 订阅的远程访问木马。必须清除所有三种持久化机制。
2. **IIS/Apache 上的 Web Shell**:Web 根目录中的 PHP/ASPX Web Shell。删除 Shell、审计所有 Web 文件、修补应用漏洞。
3. **Rootkit 感染**:存活于清理操作的内核级 Rootkit。需要从已知良好的介质完全重镜像。
4. **无文件恶意软件(Fileless Malware)**:基于 PowerShell 的攻击,驻留于内存和注册表。删除注册表项、清除 WMI 订阅、重启系统。
5. **Active Directory 攻陷**:攻击者创建了后门账号和黄金票据。重置 KRBTGT、删除流氓账号、审计组成员关系。

## 输出格式
- 带时间戳的根除操作日志(所有已删除产物)
- 凭据轮换确认报告
- 漏洞补丁验证
- 根除后验证扫描结果
- 已清理并可进入恢复阶段的系统清单

Related Skills

reverse-engineering-rust-malware

9
from killvxk/cybersecurity-skills-zh

使用 IDA Pro 和 Ghidra 对 Rust 编译的恶意软件进行逆向工程,掌握处理非空终止字符串、提取 crate 依赖项和 Rust 特有控制流分析的专项技术。

reverse-engineering-malware-with-ghidra

9
from killvxk/cybersecurity-skills-zh

使用 NSA 的 Ghidra 反汇编器和反编译器对恶意软件二进制文件进行逆向工程,在汇编和伪 C 代码层面理解其内部逻辑、密码学例程、C2 协议和规避技术。适用于恶意软件逆向工程、反汇编分析、反编译、二进制分析或理解恶意软件内部机制等请求。

reverse-engineering-dotnet-malware-with-dnspy

9
from killvxk/cybersecurity-skills-zh

使用 dnSpy 反编译器和调试器对 .NET 恶意软件进行逆向工程,分析 C#/VB.NET 源代码,识别混淆技术,提取配置信息,理解包括信息窃取器、远程访问木马(RAT)和加载器在内的恶意功能。适用于 .NET 恶意软件分析、C# 恶意软件反编译、托管代码逆向工程或 .NET 混淆分析等请求。

reverse-engineering-android-malware-with-jadx

9
from killvxk/cybersecurity-skills-zh

使用 JADX 反编译器对恶意 Android APK 文件进行逆向工程,分析 Java/Kotlin 源代码,识别包括数据窃取、C2 通信、权限提升和覆盖攻击在内的恶意功能。检查 Manifest 权限、Receiver、Service 及原生库。适用于 Android 恶意软件分析、APK 逆向工程、移动端恶意软件调查或 Android 威胁分析等请求。

performing-static-malware-analysis-with-pe-studio

9
from killvxk/cybersecurity-skills-zh

使用 PEStudio 对 Windows PE(可移植可执行文件)恶意软件样本进行静态分析, 检查文件头、导入表、字符串、资源和指标,无需执行二进制文件。 识别可疑特征,包括加壳、反分析技术和恶意导入。适用于静态恶意软件分析、 PE 文件检查、Windows 可执行文件分析或执行前恶意软件分级等请求场景。

performing-malware-triage-with-yara

9
from killvxk/cybersecurity-skills-zh

使用 YARA 规则对文件模式、字符串、字节序列和结构特征进行匹配,快速分级和分类恶意软件样本, 识别已知恶意软件家族及可疑指标。涵盖规则编写、扫描和与分析流程的集成。适用于 YARA 规则创建、 恶意软件分类、模式匹配、样本分级或基于签名的检测等请求场景。

performing-malware-persistence-investigation

9
from killvxk/cybersecurity-skills-zh

系统性地调查 Windows 和 Linux 系统上的所有持久化机制,以识别恶意软件如何在重启后存活并维持访问。

performing-malware-ioc-extraction

9
from killvxk/cybersecurity-skills-zh

恶意软件 IOC(失陷指标)提取是指通过分析恶意软件,识别可操作的失陷指标,包括文件哈希、网络指标(C2 域名、IP 地址、URL)、注册表修改、互斥体名称、嵌入字符串和行为产物。

performing-malware-hash-enrichment-with-virustotal

9
from killvxk/cybersecurity-skills-zh

使用 VirusTotal API 富化恶意软件文件哈希,获取检测率、行为分析、YARA 匹配和上下文威胁情报,用于事件分类和 IOC 验证。

performing-firmware-malware-analysis

9
from killvxk/cybersecurity-skills-zh

分析固件镜像中嵌入的恶意软件、后门和未授权修改,目标包括路由器、IoT 设备、UEFI/BIOS 和嵌入式系统。涵盖固件提取、文件系统分析、二进制逆向工程和 Bootkit 检测。适用于固件安全 分析、IoT 恶意软件调查、UEFI Rootkit 检测或嵌入式设备入侵评估等请求场景。

performing-automated-malware-analysis-with-cape

9
from killvxk/cybersecurity-skills-zh

部署和操作 CAPEv2 沙箱,进行自动化恶意软件分析,具备行为监控、载荷提取、配置解析和反规避能力。

implementing-patch-management-for-ot-systems

9
from killvxk/cybersecurity-skills-zh

本技能涵盖为OT/ICS环境实施结构化补丁管理程序,在传统IT补丁方法可能导致过程中断或安全隐患的情况下进行管理。内容包括供应商兼容性测试、基于风险的补丁优先级排序、通过测试环境的分阶段部署、维护窗口协调、回滚程序,以及在因运营约束或供应商限制无法应用补丁时的补偿控制措施。