Install
$ agentstack add skill-killvxk-cybersecurity-skills-zh-analyzing-malware-behavior-with-cuckoo-sandbox ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
使用 Cuckoo Sandbox 分析恶意软件行为
适用场景
- 可疑样本通过静态分析分类后,需要在受控环境中进行行为观察
- 需要捕获恶意软件执行期间的网络流量、文件投放、注册表修改和 API 调用
- 确定完整的感染链,包括第二阶段载荷下载和持久化机制
- 基于观察到的运行时活动生成行为签名和 YARA 规则
- 对批量恶意软件样本进行自动化分析,要求一致的报告输出
不适用于在配置错误的沙箱中通过网络共享传播的已知勒索软件变种;请先验证网络隔离。
前置条件
- Cuckoo Sandbox 3.x 安装在专用分析服务器上(推荐 Ubuntu 22.04)
- 配置了 Windows 10/11 快照的客户虚拟机(安装 Cuckoo agent,在干净状态下拍取快照)
- VirtualBox、KVM 或 VMware 配置为 Cuckoo 虚拟化后端
- 隔离网络,使用 InetSim 或 FakeNet-NG 模拟互联网服务
- 集成 Suricata 或 Snort,用于分析期间的网络级签名匹配
- 足够的磁盘空间用于 PCAP 捕获和内存转储(推荐最少 500 GB)
工作流程
步骤 1:向 Cuckoo 提交样本
提交恶意软件样本进行自动化分析:
# 通过命令行提交
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'
步骤 2:实时监控执行过程
跟踪分析进度并观察实时行为:
# 查看 Cuckoo 分析日志
tail -f /opt/cuckoo/log/cuckoo.log
# 监控分析任务状态
cuckoo status
# 访问 Cuckoo Web 界面查看实时截图和进程树
# 导航到 http://localhost:8080/analysis//
执行期间需关注的关键行为事件:
- 进程创建链(父子进程关系)
- 向外部 IP 发起的网络连接尝试
- 在临时目录或系统文件夹中投放文件
- 对 Run 键或服务条目的注册表修改
- 与加密(CryptEncrypt)、注入(WriteProcessMemory)或逃避相关的 API 调用
步骤 3:分析进程活动
检查 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})")
步骤 4:审查网络活动
检查网络连接、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
步骤 5:检查文件系统和注册表变更
记录持久化机制和投放的文件:
# 文件操作
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}")
步骤 6:检查签名和评分
检查 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")
步骤 7:提取内存转储工件
分析执行期间捕获的完整内存转储:
# 内存转储保存位置:
# /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)以正确捕获行为 |
工具与系统
- Cuckoo Sandbox:开源自动化恶意软件分析系统,提供行为报告、网络捕获和内存转储
- InetSim:互联网服务模拟套件,为隔离恶意软件分析网络提供伪造的 HTTP、DNS、SMTP 和其他服务
- FakeNet-NG:FLARE 团队的网络模拟工具,拦截并重定向所有网络流量进行分析
- Suricata:与 Cuckoo 集成的网络 IDS/IPS,用于实时检测恶意网络流量的基于签名的检测
- Volatility:内存取证框架,用于分析 Cuckoo 分析期间捕获的内存转储
常见场景
场景:分析多阶段投放器
场景背景:静态分析发现一个导入量极少、高熵的加壳可执行文件。样本需要沙箱执行以观察解包、载荷投递和 C2 建立过程。
方法:
- 以延长超时(600 秒)将样本提交给 Cuckoo,以捕获缓慢触发的行为
- 检查进程树中的子进程创建(投放器启动载荷进程)
- 识别 %TEMP%、%APPDATA% 或系统目录中的投放文件
- 提取投放文件并计算哈希值以进行单独分析
- 映射网络连接,识别初始执行后联系的 C2 基础设施
- 检查注册表修改中的持久化机制(Run 键、计划任务、服务)
- 将行为签名与已知恶意软件家族进行比对
常见陷阱:
- 使用不足的分析超时,导致沙箱在第二阶段载荷执行前终止
- 未配置 InetSim 响应 DNS 和 HTTP 请求,导致恶意软件无法完成 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
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: killvxk
- Source: killvxk/cybersecurity-skills-zh
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.