L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Productivité · SKILL.md

investigating-ransomware-attack-artifacts

investigating-ransomware-attack-artifacts

识别、收集和分析勒索软件攻击制品,以确定变种、初始访问向量、加密范围和恢复选项。

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: investigating-ransomware-attack-artifacts description: 识别、收集和分析勒索软件攻击制品,以确定变种、初始访问向量、加密范围和恢复选项。 domain: cybersecurity subdomain: digital-forensics tags: [forensics, ransomware, malware-analysis, incident-response, encryption-recovery, evidence-collection] version: "1.0" author: mahipal license: Apache-2.0

调查勒索软件攻击制品

适用场景

  • 在系统上发现勒索软件加密后立即响应时
  • 进行取证分析以了解勒索软件事件的完整范围时
  • 识别勒索软件变种并确定是否可以解密时
  • 追踪从初始访问到加密的攻击链时
  • 记录证据以支持执法机构和保险索赔时

前置条件

  • 受影响系统的取证镜像(在修复前保留)
  • 在系统关机前捕获的内存转储(如果可用)
  • 勒索软件留言(Ransom notes)和加密文件样本
  • 攻击期间的网络流量捕获
  • Windows 事件日志、Prefetch 文件和注册表 hive
  • 访问勒索软件识别工具(ID Ransomware、No More Ransom)
  • 用于恶意软件分析的隔离沙箱环境

工作流程

步骤 1:保存证据并识别勒索软件变种

# 重要提示:切勿重启系统。如果可能,请先保存内存。
# 加密密钥可能仍在内存中。

# 收集勒索软件留言
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

步骤 2:确定攻击时间线

# 查找最早的加密文件(加密开始时间)
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"

步骤 3:追踪初始访问和横向移动

# 检测 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

步骤 4:评估加密范围和恢复选项

# 按目录统计加密文件数量
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:部分加密后的恢复 确定在遏制前哪些系统和文件被加密,检查存活的卷影副本,验证备份完整性和恢复能力,尝试基于内存的密钥恢复,联系执法机构了解潜在解密器的可用性。

Skills enregistrées