CyberSaR-KAUST/LCC-LLM-Leveraging-Code-Centric-Dataset-for-Large-Language-Models-Malware-Family-Attribution
GitHub: CyberSaR-KAUST/LCC-LLM-Leveraging-Code-Centric-Dataset-for-Large-Language-Models-Malware-Family-Attribution
LCC-LLM 是一个大规模以代码为中心的恶意软件分析数据集,整合了反汇编、反编译、控制流图、威胁情报与知识图谱等多维度数据,并为大语言模型在恶意软件家族归因任务上的微调提供了预构建训练样本。
Stars: 0 | Forks: 0
**LCC-LLM:利用以代码为中心的数据集进行大型语言模型恶意软件家族归因**
**大规模以代码为中心的数据集 (Large-scale Code-Centric Dataset, LCCD)** 是一个恶意软件分析数据集,包含约 34,700 个二进制样本,提供了深度静态分析、AI 生成的分析、反编译代码、控制流图、威胁情报数据,以及为机器学习预先构建的训练数据。
此导出文件于 **2026-04-06** 从 MongoDB 数据库生成。所有数据均存储为 **zstd 压缩的 JSONL** 文件(每行一个 JSON 对象,使用 Zstandard 压缩)。
## 数据集概览
| 指标 | 值 |
|--------|-------|
| 总样本数 | 34,692 |
| 总文档数(所有集合) | 14,190,018 |
| 总压缩大小 | ~22 GB |
| 文件格式 | `.jsonl.zst` (JSONL + Zstandard 压缩) |
| 分片目标大小 | 每个文件约 1 GB |
## 集合
| 集合 | 文档数 | 分片数 | 压缩大小 | 描述 |
|-----------|-----------|--------|----------------|-------------|
| [samples](samples/) | 34,692 | 227 | ~22 GB | 核心数据集:包含反汇编、反编译、静态分析、AI 分析、CTI 数据、embeddings 等的二进制样本 |
| [training_data](training_data/) | 183,070 | 3 | ~100 MB | 预先构建的对话式训练样本,用于在恶意软件分析任务上对 LLMs 进行 fine-tuning |
| [graph_nodes](graph_nodes/) | 13,973,255 | 8 | ~450 MB | 知识图谱:样本、恶意软件家族、技术、API 等之间的关系 |
| [metadata](metadata/) | 1 | 1 | <1 KB | 数据集版本和创建元数据 |
## 集合关联方式
```
samples (34,692 binaries)
|
|-- each sample has: disassembly, decompilation, static analysis, AI analysis,
| threat intel, embeddings, call graphs, CFGs, and more
|
|-- graph_nodes: knowledge graph built from sample relationships
| (malware families, techniques, API calls, shared behaviors)
|
|-- training_data: LLM fine-tuning examples derived from samples
(conversation-format messages with task_type labels)
```
## 前置条件
```
pip install zstandard
```
## 📥 下载完整数据集
完整的 LCCD 数据集非常大,未在此 GitHub repository 中完全托管。
完整数据集大小**超过 62 GB**。由于 GitHub 存储限制,此处仅提供 repository 文档、元数据、脚本和支持文件。
要下载完整数据集,请使用官方的 KAUST repository 链接:
🔗 **下载完整数据集:** http://hdl.handle.net/10754/709465
## 加载数据
### 流式传输(推荐用于像 `samples` 这样的大型集合)
```
import json
import zstandard as zstd
from pathlib import Path
def stream_collection(collection_dir):
"""Yield documents one at a time without loading everything into memory."""
dctx = zstd.ZstdDecompressor()
for path in sorted(Path(collection_dir).glob("*.jsonl.zst")):
with open(path, "rb") as fh:
with dctx.stream_reader(fh) as reader:
text_stream = io.TextIOWrapper(reader, encoding="utf-8")
for line in text_stream:
line = line.strip()
if line:
yield json.loads(line)
# 遍历所有样本
import io
for doc in stream_collection("samples"):
print(doc["hashes"]["sha256"], doc.get("malware_family", "unknown"))
```
### 一次性全部加载(用于较小的集合)
```
import io
import json
import zstandard as zstd
from pathlib import Path
def load_collection(collection_dir):
"""Load an entire collection into a list. Use only for smaller collections."""
docs = []
dctx = zstd.ZstdDecompressor()
for path in sorted(Path(collection_dir).glob("*.jsonl.zst")):
with open(path, "rb") as fh:
with dctx.stream_reader(fh) as reader:
text_stream = io.TextIOWrapper(reader, encoding="utf-8")
for line in text_stream:
line = line.strip()
if line:
docs.append(json.loads(line))
return docs
# 加载训练数据
training_docs = load_collection("training_data")
print(f"Loaded {len(training_docs)} training examples")
```
### 加载到 Pandas
```
import io
import json
import zstandard as zstd
import pandas as pd
from pathlib import Path
def collection_to_dataframe(collection_dir, fields=None):
"""Load a collection into a DataFrame, optionally selecting specific fields."""
rows = []
dctx = zstd.ZstdDecompressor()
for path in sorted(Path(collection_dir).glob("*.jsonl.zst")):
with open(path, "rb") as fh:
with dctx.stream_reader(fh) as reader:
text_stream = io.TextIOWrapper(reader, encoding="utf-8")
for line in text_stream:
line = line.strip()
if line:
doc = json.loads(line)
if fields:
doc = {k: doc.get(k) for k in fields}
rows.append(doc)
return pd.DataFrame(rows)
# 仅从 training_data 加载分类字段
df = collection_to_dataframe("training_data", fields=[
"file_hash", "malware_class", "class_confidence",
"difficulty_level", "task_type"
])
```
## 目录结构
```
LCCD_DATASET_JSONL/
README.md # This file
samples/ # 227 shards (~22 GB) - core binary analysis data
training_data/ # 3 shards (~100 MB) - LLM training examples
graph_nodes/ # 8 shards (~450 MB) - knowledge graph
metadata/ # 1 shard (<1 KB) - dataset version info
```
## 数据格式说明
- **压缩**:Zstandard(级别 19)。使用 `zstandard` Python 库或 `zstd` CLI 工具进行解压。
- **MongoDB `_id` 字段**已从所有文档中移除。
- **GridFS 字段**:`samples` 集合最初通过 MongoDB GridFS 存储大型字段(汇编代码、AI 分析等)。为了便于移植,这些字段已被重新组合并直接内联到每个样本文档中。
- **二进制数据**:`samples` 中的 `binary_sample` 字段包含 base64 编码的二进制内容。此字段已被**截断**(非完整二进制),以控制文件大小。
- **Datetime 字段**:存储为 ISO 8601 字符串或 MongoDB 扩展 JSON datetime 对象。
## 数据来源
此数据集中的样本收集自两个公共来源:
- **[DikeDataset](https://github.com/iosifache/DikeDataset)** - 一个为恶意软件研究精心策划的良性和恶意 PE 文件数据集。
- **[MalwareBazaar](https://bazaar.abuse.ch/)** - 由 abuse.ch 维护的公共恶意软件样本 repository。
MalwareBazaar 样本的时间跨度为 **2022 年 1 月至 2026 年 1 月**。DikeDataset 样本部分来源于 2018 年发布的早期数据集(原作者未指定具体收集时期)。所有的分析(反汇编、反编译、静态分析、AI 分析、CTI 丰富等)均作为 LCCD pipeline 的一部分在收集后进行。
## 范围与局限性
- **平台**:仅限 Windows。所有样本均为 **PE (Portable Executable)** 文件。
- **不包含 ELF、Mach-O、APK 或其他格式**。
- **良性和恶意**:该数据集包含良性和恶意样本(参见 `is_malicious` 和 `malware_category` 字段)。
- **分析工具偏差**:静态分析结果取决于所使用的工具(Ghidra、Radare2 等)。不同的工具可能会对同一二进制文件产生不同的输出。
- **AI 分析依赖于模型**:AI 生成的字段由 LLMs 在特定时间点生成,可能包含不准确之处或幻觉。
- **时间偏差**:MalwareBazaar 样本涵盖 2022-2026 年;DikeDataset 样本源自 2018 年的发布版本,收集期未指明。该数据集不会包含 2026 年 1 月之后出现的威胁。
## 预期用途
- 训练和评估用于恶意软件分类、检测和分析的 ML 模型。
- 在网络安全和逆向工程任务上对 LLMs 进行 fine-tuning(使用 `training_data` 集合)。
- 研究恶意软件行为、家族聚类和威胁情报关联。
- 构建静态分析 pipeline 并进行基准测试。
**超出范围的用途**:此数据集旨在用于防御性安全研究和教育。它不应用于开发攻击性恶意软件或为攻击提供便利。
## 伦理考量
- 此数据集是根据公共 repository(DikeDataset 和 MalwareBazaar)中的**真实恶意软件样本**构建的。
- **未包含完整的二进制文件**。`binary_sample` 字段仅包含每个文件的截断的、base64 编码的片段——不足以重建或执行原始二进制文件。
- 该数据集包含恶意软件的反编译代码、反汇编和行为分析。虽然这些信息对研究很有价值,但理论上有可能被恶意行为者利用。这与现有公共资源(VirusTotal、MalwareBazaar 等)公开共享类似分析数据以推进集体防御的做法是一致的。
- 威胁情报字段(`bazaar_data`、`cti`、`misp_data`)可能会提及现实世界中的威胁行为者、活动或基础设施。
## 📜 引用
如果您使用此数据集,请引用:
```
@article{hadi2026lcc,
title={LCC-LLM: Leveraging Code-Centric Dataset for Large Language Models Malware Family Attribution},
author={Hadi, Hassan Jalil and Shoker, Ali},
year={2026}
}
```
## 👨💻 维护者
**CyberSar Lab**
🔗 https://cybersar.kaust.edu.sa/
标签:AI安全, Apex, Chat Copilot, DAST, DLL 劫持, DNS 反向解析, IP 地址批量处理, JSONL, LLM微调, MongoDB, URL提取, Wayback Machine, Zstandard, 二进制分析, 云安全监控, 云安全运维, 代码分析, 凭证管理, 反汇编, 反编译, 图神经网络, 大语言模型, 威胁情报, 安全大模型, 安全数据集, 开发者工具, 恶意软件分析, 恶意软件家族分类, 控制流图, 无线安全, 时序数据库, 机器学习, 样本分析, 深度学习, 网络信息收集, 网络安全, 网络安全审计, 自动化分析, 跨站脚本, 逆向工具, 隐私保护, 静态分析