cve-cwe-consensus
收藏资源简介:
CVE-to-CWE共识数据集是一个多标签分类数据集,旨在将通用漏洞披露(CVE)描述映射到其对应的通用弱点枚举(CWE)类型。该数据集专为微调指令调优的大型语言模型而构建,适用于网络安全领域的漏洞分类和弱点分析任务。数据集包含116,793个经过严格筛选的示例,划分为训练集(91,862例)、验证集(13,705例)和测试集(11,226例)。每个数据样本采用对话式结构,包含系统提示、用户输入(CVE描述)和助手回复(CWE ID列表)三个角色-内容对,格式可直接用于聊天模板的监督微调。数据集的标签构建基于高精度共识原则:仅当美国国家漏洞数据库(NVD)和CVE编号机构(CNA)两个独立官方来源对CWE分配达成一致时,才将对应的CWE纳入标签集,且所有CWE ID均统一归约至CWE View-1003视图(包含约130个基础弱点类型)。数据处理流程包括数据源整合、CWE归约、共识过滤、非英语和过短描述剔除、基于MinHash的去重处理(确保近似重复文本不跨越数据集分割),以及基于去重家族的数据集分割(约80/10/10比例)。数据来源包括cvelistV5(特定提交版本)、NVD(2026年5月29日提取)和MITRE CWE v4.20目录。统计特征显示:约33%的扫描CVE被保留,数据覆盖存在近期偏差(主要集中在2023年及之后的CVE),标签空间包含127个不同的View-1003 CWE,分布呈长尾型(CWE-79最常见),多数样本为单标签,约14%的样本携带两个或更多标签。该数据集适用于训练和评估用于漏洞分类、弱点识别和优先级排序的模型,其测试集可用于衡量多标签分类性能(如精确匹配、微/宏观F1分数)。主要限制包括:数据时间分布偏向近期CVE、共识机制排除了来源间存在分歧的模糊案例、归约至View-1003丢失了变体级特异性、仅支持英语,且不适用于替代分析师对新颖或复杂漏洞的审查。数据集采用CC BY 4.0许可发布,并需遵守NVD(美国政府作品,公共领域)、CVE项目(需署名使用)和MITRE CWE(需署名使用)的上游许可要求。
The CVE-to-CWE consensus dataset is a multi-label classification dataset designed to map Common Vulnerabilities and Exposures (CVE) descriptions to their corresponding Common Weakness Enumeration (CWE) types. It is specifically built for fine-tuning instruction-tuned large language models and is suitable for vulnerability classification and weakness analysis tasks in the cybersecurity domain. The dataset contains 116,793 rigorously filtered examples, divided into a training set (91,862 instances), a validation set (13,705 instances), and a test set (11,226 instances). Each data sample adopts a conversational structure, consisting of three role-content pairs: system prompt, user input (CVE description), and assistant response (list of CWE IDs), with a format directly usable for supervised fine-tuning of chat templates. The datasets label construction is based on a high-precision consensus principle: CWE labels are included only when two independent official sources—the National Vulnerability Database (NVD) and CVE Numbering Authorities (CNA)—agree on the CWE assignment, and all CWE IDs are uniformly reduced to the CWE View-1003 view (which includes approximately 130 basic weakness types). The data processing pipeline involves data source integration, CWE reduction, consensus filtering, removal of non-English and overly short descriptions, MinHash-based deduplication (ensuring that near-duplicate texts do not cross dataset splits), and dataset splitting based on deduplicated families (approximately 80/10/10 ratio). Data sources include cvelistV5 (specific commit version), NVD (extracted on May 29, 2026), and MITRE CWE v4.20 catalog. Statistical characteristics show that approximately 33% of scanned CVEs are retained, with a recency bias in data coverage (primarily focused on CVEs from 2023 and later). The label space contains 127 distinct View-1003 CWEs, with a long-tailed distribution (CWE-79 being the most common). Most samples are single-labeled, with about 14% of samples carrying two or more labels. This dataset is suitable for training and evaluating models for vulnerability classification, weakness identification, and prioritization, and its test set can be used to measure multi-label classification performance (e.g., exact match, micro/macro F1 scores). Key limitations include: temporal distribution bias toward recent CVEs, the consensus mechanism excluding ambiguous cases with discrepancies between sources, reduction to View-1003 losing variant-level specificity, English-only support, and unsuitability for replacing analyst review of novel or complex vulnerabilities. The dataset is released under the CC BY 4.0 license, with compliance required for upstream licenses from NVD (U.S. government work, public domain), CVE project (requires attribution for use), and MITRE CWE (requires attribution for use).
数据集概述:CVE-to-CWE Consensus
数据集名称: CVE-to-CWE Consensus
数据集地址: https://huggingface.co/datasets/eiphuggincve/cve-cwe-consensus
许可协议: CC BY 4.0
语言: 英语
任务类别: 文本分类、文本生成
标签: 网络安全、CVE、CWE、漏洞、安全
数据集大小: 69,386 个样本(超过 10 万,小于 100 万)
数据集详细描述
1. 核心任务
- 任务目标: 根据给定的 CVE(通用漏洞披露)描述,预测其对应的 CWE(通用弱点枚举)ID。这是一个多标签分类任务。
2. 数据规模与划分
- 总样本数: 69,386 个例子
- 数据划分:
- 训练集 (Train):55,810 个样本
- 验证集 (Validation):6,774 个样本
- 测试集 (Test):6,802 个样本
- 数据格式: 采用对话格式的
messages(包含 system/user/assistant 角色),可直接用于聊天模板的监督式微调 (SFT)。
3. 数据构建方法(信任模型)
该数据集的核心特点是其高精度的标签构建流程,旨在提供可靠的共识标签:
- 数据来源: 仅使用官方上游数据源,包括 NVD CVE API 2.0、CVEProject/cvelistV5 和 MITRE CWE 目录。
- 标签合并 (Roll-up): 将所有分配的 CWE 上溯至其最近的 CWE View-1003(约130个弱点)映射祖先,以统一标准。
- 共识机制: 最终的 CWE 标签是 NVD 和 CNA(CVE编号机构)两个独立官方来源上溯后 CWE 集合的交集。只有当两者独立且一致地认定时,该 CWE 才会被保留。这排除了单一来源可能引入的错误。
- 过滤与去重: 过滤掉被拒绝/争议的 CVE、非英语或过短的描述以及伪标签。使用 MinHash 算法对接近重复的描述进行去重,并确保整个重复族只位于一个数据划分中,防止数据泄露。
- 类别平衡: 对每个 CWE 标签的样本数量设置了 2,500 个实例的上限,以防止常见类别主导数据集,改善长尾分布。
4. 标签空间与统计
- 有效标签数: 约 117 个(来自原始 127 个 View-1003 CWE,剔除了少于 50 个实例的稀有标签)。
- 标签分布: 呈长尾分布,最常见的是 CWE-79(跨站脚本)。
- 标签基数: 大部分样本只有一个标签,约 14% 的样本有两个或以上标签。
- 共识保留率: 扫描的 354,163 个 CVE 中,约 33%(116,793 个)达到了共识。
5. 主要限制与偏差
- 时间偏差: 数据集主要集中在 2023年及以后 的 CVE,因为自那时起 CNA 才开始更可靠地填充 CWE 信息。对较旧的 CVE 风格覆盖较弱。
- 精度优先: 共识机制是高精度而非穷举的。两方数据源意见不一致的 CVE(通常存在歧义)被排除,因此该数据集比完整的 CVE 集合“更干净、更简单”。
- 粒度损失: 上溯至 View-1003 会丢失其在子类别中的具体信息。
- 语言限制: 仅包含英语描述。
6. 预期用途
- 微调或评估能够将 CVE 描述分类为 CWE 类型的模型。
- 适用于漏洞分类、信息丰富化、优先级排序等辅助任务。
- 测试集专为衡量多标签性能而设(如精确匹配、微平均/宏平均 F1 分数)。
数据样例
json {"messages": [ {"role": "system", "content": "You are a vulnerability analyst. Given a CVE description, reply with only the CWE ID(s) it maps to, comma-separated."}, {"role": "user", "content": "A reflected cross-site scripting issue in Acme Portal lets a remote attacker inject arbitrary script via the q parameter."}, {"role": "assistant", "content": "CWE-79"} ]}
引用与归属
- 数据集许可: CC BY 4.0
- 衍生来源: 数据集基于公共来源构建,请遵守各自条款:
- NVD (NIST): 美国政府作品,属于公共领域。
- CVE Program / cvelistV5: © CVE Program,CVE 记录可自由使用,需注明出处。
- MITRE CWE: © The MITRE Corporation,可自由使用,需注明出处。
- 商标: CWE™ 和 CVE® 是 MITRE 公司的商标。




