Executes malware samples in Cuckoo Sandbox to observe runtime behaviors including process creation, filesystem/registry changes, network activity, and API calls. Generates reports for malware classification and IOC extraction.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
- 可疑样本通过静态分析分类后,需要在受控环境中进行行为观察
Executes malware samples in Cuckoo Sandbox to analyze runtime behavior including processes, files, registry, network, and API calls. Generates reports for classification and IOC extraction.
Executes malware samples in Cuckoo Sandbox to observe runtime behavior like process creation, file changes, registry mods, network activity, and API calls. Generates reports for classification and IOC extraction.
Performs interactive dynamic malware analysis using ANY.RUN cloud sandbox: observe execution behaviors, interact with prompts, capture process trees, network traffic, and system changes. Useful for sandbox detonation and real-time behavior observation.
Share bugs, ideas, or general feedback.
不适用于在配置错误的沙箱中通过网络共享传播的已知勒索软件变种;请先验证网络隔离。
提交恶意软件样本进行自动化分析:
# 通过命令行提交
cuckoo submit /path/to/suspect.exe
# 提交并指定分析超时时间(300 秒)
cuckoo submit --timeout 300 /path/to/suspect.exe
# 提交并指定虚拟机和分析包
cuckoo submit --machine win10_x64 --package exe --timeout 300 /path/to/suspect.exe
# 通过 REST API 提交
curl -F "file=@suspect.exe" -F "timeout=300" -F "machine=win10_x64" \
http://localhost:8090/tasks/create/file
# 提交 URL 进行分析
curl -F "url=http://malicious-site.com/payload" -F "timeout=300" \
http://localhost:8090/tasks/create/url
# 检查任务状态
curl http://localhost:8090/tasks/view/1 | jq '.task.status'
跟踪分析进度并观察实时行为:
# 查看 Cuckoo 分析日志
tail -f /opt/cuckoo/log/cuckoo.log
# 监控分析任务状态
cuckoo status
# 访问 Cuckoo Web 界面查看实时截图和进程树
# 导航到 http://localhost:8080/analysis/<task_id>/
执行期间需关注的关键行为事件:
检查 Cuckoo 报告中的进程树和 API 调用跟踪:
# 以编程方式解析 Cuckoo JSON 报告
import json
with open("/opt/cuckoo/storage/analyses/1/reports/report.json") as f:
report = json.load(f)
# 进程树分析
for process in report["behavior"]["processes"]:
pid = process["pid"]
ppid = process["ppid"]
name = process["process_name"]
print(f"PID: {pid} PPID: {ppid} Name: {name}")
# 提取可疑 API 调用
for call in process["calls"]:
api = call["api"]
if api in ["CreateRemoteThread", "VirtualAllocEx", "WriteProcessMemory",
"NtCreateThreadEx", "RegSetValueExA", "URLDownloadToFileA"]:
args = {arg["name"]: arg["value"] for arg in call["arguments"]}
print(f" [!] {api}({args})")
检查网络连接、DNS 查询和 HTTP 请求:
# 从 Cuckoo 报告中提取网络分析
network = report["network"]
# DNS 解析
print("DNS 查询:")
for dns in network.get("dns", []):
print(f" {dns['request']} -> {dns.get('answers', [])}")
# HTTP 请求
print("\nHTTP 请求:")
for http in network.get("http", []):
print(f" {http['method']} {http['uri']}(Host:{http['host']})")
if http.get("body"):
print(f" Body:{http['body'][:200]}")
# TCP 连接
print("\nTCP 连接:")
for tcp in network.get("tcp", []):
print(f" {tcp['src']}:{tcp['sport']} -> {tcp['dst']}:{tcp['dport']}")
# 提取 PCAP 进行更深入的 Wireshark 分析
# PCAP 位置:/opt/cuckoo/storage/analyses/1/dump.pcap
记录持久化机制和投放的文件:
# 文件操作
print("创建/修改的文件:")
for f in report["behavior"].get("summary", {}).get("files", []):
print(f" {f}")
# 带哈希值的投放文件
print("\n投放文件:")
for dropped in report.get("dropped", []):
print(f" 路径:{dropped['filepath']}")
print(f" SHA-256:{dropped['sha256']}")
print(f" 大小:{dropped['size']} 字节")
print(f" 类型:{dropped['type']}")
# 注册表修改
print("\n修改的注册表键:")
for key in report["behavior"].get("summary", {}).get("keys", []):
print(f" {key}")
检查 Cuckoo 的行为签名和威胁评分:
# 触发的行为签名
print("触发的签名:")
for sig in report.get("signatures", []):
severity = sig["severity"]
name = sig["name"]
description = sig["description"]
marker = "[!]" if severity >= 3 else "[*]"
print(f" {marker} [{severity}/5] {name}: {description}")
for mark in sig.get("marks", []):
if mark.get("call"):
print(f" API: {mark['call']['api']}")
if mark.get("ioc"):
print(f" IOC: {mark['ioc']}")
# 整体评分
score = report.get("info", {}).get("score", 0)
print(f"\n整体威胁评分:{score}/10")
分析执行期间捕获的完整内存转储:
# 内存转储保存位置:
# /opt/cuckoo/storage/analyses/1/memory.dmp
# 使用 Volatility 分析内存转储
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.pslist
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.malfind
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.netscan
| 术语 | 定义 |
|---|---|
| 动态分析 | 在受控环境中执行恶意软件以观察运行时行为,包括系统调用、网络活动和文件操作 |
| 沙箱逃避 | 恶意软件用于检测虚拟/沙箱环境并改变行为以避免分析的技术(睡眠计时器、虚拟机检测、用户交互检测) |
| API 钩子 | Cuckoo 拦截恶意软件发出的 Windows API 调用以记录函数名称、参数和返回值的方法 |
| InetSim | 互联网服务模拟工具,在隔离分析网络内响应恶意软件的网络请求(HTTP、DNS、SMTP) |
| 进程注入 | 将代码注入合法进程的恶意软件技术;通过监控 VirtualAllocEx 和 WriteProcessMemory API 序列检测 |
| 行为签名 | 基于规则的检测,匹配特定的 API 调用序列、文件操作或网络活动,与已知恶意软件行为对应 |
| 分析包 | Cuckoo 模块,定义如何在客户虚拟机中执行特定文件类型(exe、dll、pdf、doc)以正确捕获行为 |
场景背景:静态分析发现一个导入量极少、高熵的加壳可执行文件。样本需要沙箱执行以观察解包、载荷投递和 C2 建立过程。
方法:
常见陷阱:
动态分析报告 - CUCKOO SANDBOX
==========================================
任务 ID: 1547
样本: suspect.exe(SHA-256:e3b0c44298fc1c149afbf4c8996fb924...)
分析时间: 300 秒
虚拟机: win10_x64(Windows 10 21H2)
评分: 8.5/10
进程树
suspect.exe(PID:2184)
└── cmd.exe(PID:3456)
└── powershell.exe(PID:4012)
└── svchost_fake.exe(PID:4568)
文件系统活动
[已创建] C:\Users\Admin\AppData\Local\Temp\payload.dll
[已创建] C:\Windows\System32\svchost_fake.exe
[已修改] C:\Windows\System32\drivers\etc\hosts
注册表修改
[设置] HKCU\Software\Microsoft\Windows\CurrentVersion\Run\WindowsUpdate = "C:\Windows\System32\svchost_fake.exe"
[设置] HKLM\SYSTEM\CurrentControlSet\Services\FakeService\ImagePath = "C:\Windows\System32\svchost_fake.exe"
网络活动
DNS: update.malicious[.]com -> 185.220.101.42
HTTP: POST hxxps://185.220.101[.]42/gate.php(信标)
TCP: 10.0.2.15:49152 -> 185.220.101.42:443(237 个连接)
行为签名
[!] [4/5] injection_createremotethread:向远程进程注入代码
[!] [4/5] persistence_autorun:修改 Run 注册表键以实现持久化
[!] [3/5] network_cnc_http:执行 HTTP C2 通信
[*] [2/5] antiav_detectfile:检查杀毒软件产品文件
投放文件
payload.dll SHA-256: abc123... 大小:98304 类型:PE32 DLL
svchost_fake.exe SHA-256: def456... 大小:184320 类型:PE32 EXE