Identifies ransomware variants from notes and file extensions, collects artifacts like encrypted samples and logs, analyzes timelines, IoCs, and recovery options for incident response.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
- 在系统上发现勒索软件加密后立即响应时
Guides ransomware forensic analysis: preserves evidence, collects ransom notes and encrypted samples, identifies variants via extensions, traces access vectors, evaluates recovery.
Guides ransomware forensic analysis: preserves memory dumps and logs, collects ransom notes and encrypted files, identifies variants, traces initial access, assesses recovery options.
Guides structured ransomware incident response from detection and containment to forensics, decryption assessment, recovery, and hardening. Covers negotiations, backups, regulations. For ransomware attacks.
Share bugs, ideas, or general feedback.
# 重要提示:切勿重启系统。如果可能,请先保存内存。
# 加密密钥可能仍在内存中。
# 收集勒索软件留言
cp /mnt/evidence/Users/*/Desktop/README*.txt /cases/case-2024-001/ransomware/ransom_notes/
cp /mnt/evidence/Users/*/Desktop/DECRYPT*.txt /cases/case-2024-001/ransomware/ransom_notes/
find /mnt/evidence/ -name "*.hta" -o -name "*DECRYPT*" -o -name "*RANSOM*" \
2>/dev/null | head -20 > /cases/case-2024-001/ransomware/note_locations.txt
# 收集加密文件样本(用于识别)
find /mnt/evidence/Users/ -name "*.encrypted" -o -name "*.locked" -o -name "*.crypted" \
| head -10 > /cases/case-2024-001/ransomware/encrypted_samples.txt
# 通过文件扩展名和留言识别勒索软件变种
python3 << 'PYEOF'
import os, hashlib, re
ransomware_indicators = {
'.lockbit': 'LockBit', '.blackcat': 'BlackCat/ALPHV',
'.royal': 'Royal', '.akira': 'Akira', '.clop': 'Cl0p',
'.conti': 'Conti', '.ryuk': 'Ryuk', '.revil': 'REvil/Sodinokibi',
'.hive': 'Hive', '.blackbasta': 'Black Basta', '.play': 'Play',
}
samples_dir = '/cases/case-2024-001/ransomware/samples/'
for f in os.listdir(samples_dir):
ext = os.path.splitext(f)[1].lower()
variant = ransomware_indicators.get(ext, '未知')
sha256 = hashlib.sha256(open(os.path.join(samples_dir, f), 'rb').read()).hexdigest()
print(f"文件:{f} | 扩展名:{ext} | 疑似变种:{variant} | SHA-256:{sha256}")
# 从留言中解析 IoC
note_dir = '/cases/case-2024-001/ransomware/ransom_notes/'
for note in os.listdir(note_dir):
with open(os.path.join(note_dir, note), 'r', errors='ignore') as f:
content = f.read()
btc = re.findall(r'[13][a-km-zA-HJ-NP-Z1-9]{25,34}|bc1[a-zA-HJ-NP-Z0-9]{25,39}', content)
tor = re.findall(r'[a-z2-7]{56}\.onion', content)
emails = re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', content)
print(f"\n留言:{note}")
if btc: print(f" 比特币地址:{btc}")
if tor: print(f" Tor 地址:{tor}")
if emails: print(f" 联系邮箱:{emails}")
PYEOF
# 查找最早的加密文件(加密开始时间)
find /mnt/evidence/ -name "*.encrypted" -printf '%T+ %p\n' 2>/dev/null | sort | head -5 \
> /cases/case-2024-001/ransomware/encryption_start.txt
# 分析 Prefetch 文件中的勒索软件可执行文件
ls /mnt/evidence/Windows/Prefetch/ | grep -iE "(encrypt|ransom|lock|crypt)" \
> /cases/case-2024-001/ransomware/prefetch_hits.txt
# 检查 Windows 事件日志中的关键事件
python3 << 'PYEOF'
import json
from evtx import PyEvtxParser
parser = PyEvtxParser("/cases/case-2024-001/evtx/Security.evtx")
attack_events = []
for record in parser.records_json():
data = json.loads(record['data'])
event_id = str(data['Event']['System']['EventID'])
timestamp = data['Event']['System']['TimeCreated']['#attributes']['SystemTime']
if event_id in ('4624', '4625', '4648', '4672', '4697', '4698', '4688', '1102'):
event_data = data['Event'].get('EventData', {})
attack_events.append({'time': timestamp, 'event_id': event_id,
'data': json.dumps(event_data, default=str)[:200]})
attack_events.sort(key=lambda x: x['time'])
print("=== 勒索软件攻击时间线 ===\n")
for event in attack_events[-50:]:
print(f" [{event['time']}] 事件 ID {event['event_id']}:{event['data'][:150]}")
PYEOF
# 检查卷影副本删除(常见勒索软件行为)
ls /mnt/evidence/Windows/Prefetch/ | grep -i "vssadmin\|wmic\|bcdedit\|wbadmin"
# 检测 RDP 暴力破解
python3 << 'PYEOF'
import json
from evtx import PyEvtxParser
from collections import defaultdict
parser = PyEvtxParser("/cases/case-2024-001/evtx/Security.evtx")
failed_rdp = defaultdict(int)
successful_rdp = []
for record in parser.records_json():
data = json.loads(record['data'])
event_id = str(data['Event']['System']['EventID'])
event_data = data['Event'].get('EventData', {})
timestamp = data['Event']['System']['TimeCreated']['#attributes']['SystemTime']
if event_id == '4625': # 登录失败
if str(event_data.get('LogonType', '')) == '10': # RDP
failed_rdp[event_data.get('IpAddress', 'Unknown')] += 1
if event_id == '4624': # 成功登录
if str(event_data.get('LogonType', '')) in ('10', '3'):
successful_rdp.append({
'time': timestamp,
'user': event_data.get('TargetUserName', ''),
'ip': event_data.get('IpAddress', ''),
'type': event_data.get('LogonType', '')
})
print("=== RDP 失败尝试 ===")
for ip, count in sorted(failed_rdp.items(), key=lambda x: x[1], reverse=True)[:10]:
print(f" {ip}:{count} 次失败尝试")
print("\n=== 成功的网络/RDP 登录 ===")
for logon in successful_rdp[-20:]:
type_name = 'RDP' if logon['type'] == '10' else '网络'
print(f" [{logon['time']}] {logon['user']} 来自 {logon['ip']} ({type_name})")
PYEOF
# 检查可疑的下载文件(钓鱼相关)
find /mnt/evidence/Users/*/Downloads/ -name "*.exe" -o -name "*.dll" -o -name "*.js" \
-o -name "*.vbs" -o -name "*.ps1" 2>/dev/null \
> /cases/case-2024-001/ransomware/suspicious_downloads.txt
# 按目录统计加密文件数量
find /mnt/evidence/ -name "*.encrypted" 2>/dev/null | \
awk -F/ '{OFS="/"; NF--; print}' | sort | uniq -c | sort -rn | head -20
# 检查卷影副本是否存活
vssadmin list shadows 2>/dev/null > /cases/case-2024-001/ransomware/vss_status.txt
# 检查 No More Ransom 项目是否有可用解密器
echo "检查 https://www.nomoreransom.org/ 获取解密工具" \
> /cases/case-2024-001/ransomware/decryption_options.txt
# 尝试从内存转储中恢复加密密钥
if [ -f /cases/case-2024-001/memory/memory.raw ]; then
vol -f /cases/case-2024-001/memory/memory.raw yarascan \
--yara-rules 'rule RSA_Key { strings: $rsa = "RSA PRIVATE KEY" condition: $rsa }' \
> /cases/case-2024-001/ransomware/rsa_key_search.txt
fi
| 概念 | 描述 |
|---|---|
| 勒索软件变种识别 | 通过扩展名、留言和行为确定具体的勒索软件家族 |
| 双重勒索 | 将加密与数据窃取相结合并威胁公开发布的攻击方式 |
| 卷影副本 | 经常被勒索软件删除以防止恢复的 Windows 备份机制 |
| 加密范围 | 评估哪些文件、目录和系统被加密 |
| 驻留时间(Dwell time) | 初始访问到部署勒索软件之间的时间段(通常为数天到数周) |
| 留言 IoC | 勒索需求中的比特币地址、Tor 站点和电子邮件地址 |
| 密钥恢复 | 在关机前尝试从内存中提取加密密钥 |
| No More Ransom | 执法机构发起的为某些变种提供免费解密工具的项目 |
| 工具 | 用途 |
|---|---|
| ID Ransomware | 通过样本在线识别勒索软件变种的服务 |
| No More Ransom | 执法机构合作提供的免费解密工具 |
| Volatility | 用于加密密钥和恶意软件制品恢复的内存取证工具 |
| Chainsaw/Hayabusa | 用于攻击时间线重建的 Windows 事件日志分析工具 |
| PECmd | 确认勒索软件可执行文件执行的 Prefetch 分析工具 |
| YARA | 用于勒索软件变种识别的模式匹配工具 |
| Any.Run/Joe Sandbox | 用于勒索软件行为分析的在线恶意软件沙箱 |
| Capa | 通过静态分析识别恶意软件能力的 Mandiant 工具 |
场景 1:通过 RDP 发起的 LockBit 攻击 在事件日志中追踪 RDP 暴力破解的初始访问,识别攻击者 IP 和被盗账户,通过网络登录追踪横向移动,找到通过 PsExec 或 GPO 部署的 LockBit,从文件时间戳记录加密时间线,检查加密前的数据外泄。
场景 2:钓鱼引发的勒索软件 通过浏览器历史和电子邮件制品追踪钓鱼邮件,在 Prefetch 中识别恶意附件执行,在网络日志中追踪 Cobalt Strike 信标通信,追踪权限提升和域名称攻陷,记录勒索软件在网络中的部署。
场景 3:部分加密后的恢复 确定在遏制前哪些系统和文件被加密,检查存活的卷影副本,验证备份完整性和恢复能力,尝试基于内存的密钥恢复,联系执法机构了解潜在解密器的可用性。