cve-cwe-consensus / README.md
exploitintel's picture
Update dataset card to v3
6a86d45 verified
metadata
license: cc-by-4.0
language:
  - en
task_categories:
  - text-classification
  - text-generation
tags:
  - cybersecurity
  - cve
  - cwe
  - vulnerability
  - security
pretty_name: CVE-to-CWE Consensus
size_categories:
  - 100K<n<1M
dataset_info:
  features:
    - name: messages
      list:
        - name: role
          dtype: string
        - name: content
          dtype: string
  splits:
    - name: train
      num_bytes: 28397024
      num_examples: 50074
    - name: validation
      num_bytes: 5966749
      num_examples: 11052
    - name: test
      num_bytes: 5748623
      num_examples: 10514
  download_size: 39961558
  dataset_size: 40112396
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: validation
        path: data/validation-*
      - split: test
        path: data/test-*

CVE-to-CWE Consensus Dataset

A multi-label dataset mapping CVE vulnerability descriptions to their CWE weakness type(s), built for fine-tuning instruction-tuned LLMs (e.g. with Unsloth). Each label is a consensus assignment: a CWE is kept only when NVD and the CVE Numbering Authority (CNA) independently agree on it, after rolling both up to CWE View-1003 (the ~130-weakness "Weaknesses for Simplified Mapping of Published Vulnerabilities").

TL;DR

  • Task: given a CVE description, predict the CWE ID(s) — multi-label.
  • 71,640 examples — train 50,074 / validation 11,052 / test 10,514. (v3 — see "What's new in v3")
  • Format: conversational messages (system / user / assistant), ready for chat-template SFT.
  • Trust model: labels are the intersection of two independent official sources (NVD + CNA), so single-source errors are excluded by construction.

What's new in v3

This v3 revision is re-weighted to train models on the cases they actually fail (inferring the CWE when the description does not name the weakness), and to evaluate them honestly. Changes vs. the previous revision:

  • Low-information filter: bare impact-title descriptions ("<Product> <Impact> Vulnerability") that name no mechanism are dropped (~1.5% of rows; the CWE is not derivable from the text).
  • Hard-weighted training cap, train split only: when a common CWE exceeds the per-class cap (lowered to 1,500), the train split keeps inference-"hard" rows (weakness not named) over easy lexical-match rows. Validation/test are capped without this weighting, so they keep real-world prevalence — train is ~20% lexical-easy, val/test ~44%. Evaluate on the stratified easy/hard numbers.
  • 69 reviewed label corrections: gold labels that two independent models flagged and a human confirmed against the MITRE CWE definition (e.g. a CSRF labeled XSS, an SSRF labeled "improper encoding") override the computed consensus.

Models trained on the previous revision were trained on the un-reweighted data.

Example row

{"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"}
]}

Multi-label targets are comma-separated and numerically sorted, e.g. "CWE-79, CWE-352". The model input is the description only — CVE IDs and source label fields are never included, to avoid memorization/leakage.

How it was built

  1. Sources (official upstreams only):
    • NVD CVE API 2.0 — analyst-assigned CWEs (weaknesses).
    • CVEProject/cvelistV5 — CNA-supplied CWEs (problemTypes) and the English description.
    • MITRE CWE catalog (v4.20) — View-1003 membership + the ChildOf hierarchy.
  2. Roll-up: every assigned CWE is rolled up to its nearest View-1003 mapping ancestor(s).
  3. Consensus: the label is the intersection of NVD's and the CNA's rolled-up CWE sets; CVEs with no agreement are dropped.
  4. Filtering: REJECTED/DISPUTED CVEs, non-English and too-short (<40 char) descriptions are dropped; pseudo-labels (NVD-CWE-noinfo/-Other) are excluded.
  5. De-duplication: near-duplicate descriptions (MinHash, Jaccard ≥ 0.7) are grouped into families, and whole families stay within a single split, so near-identical text cannot leak across train/validation/test (verified: 0 shared descriptions across splits).
  6. Split: dedup-family-aware, ~80/10/10.

Provenance (reproducibility)

Source Version
cvelistV5 commit 7f860dcfb8260ccff2f23b4b5f685303fd314f17
NVD pulled 2026-05-29
MITRE CWE v4.20

Statistics

  • Keep rate: 115,636 of 354,163 scanned CVEs reach consensus (~33%); after the low-information filter, the rarest-CWE floor, and hard-weighted capping, 71,640 rows are exported. Most drops are "no consensus" (sources disagreed, or only one assigned a CWE).
  • Easy/hard composition (v3): the weakness is lexically named in ~20% of train rows (hard-weighted) vs ~44% of validation/test (natural prevalence).
  • Recency skew: consensus concentrates on 2023+ CVEs, because that is when CNAs began reliably populating CWE — this is the main coverage bias.
  • Label space: 127 distinct View-1003 CWEs appear in the consensus set; a minimum-examples floor (50) prunes the rarest, leaving ~117 effective labels. The distribution is long-tailed (CWE-79 most common).
  • Cardinality: most examples carry a single label; ~14% carry two or more.

Intended use

Fine-tuning or evaluating models that classify CVE descriptions into CWE types (vulnerability triage, enrichment, prioritization aids). Held-out test is intended for measuring multi-label performance (e.g. exact-match and micro/macro F1).

Limitations & biases

  • Recency-skewed (2023+) — weaker coverage of older CVE styles.
  • Consensus is high-precision, not exhaustive — CVEs where the two sources disagree (often genuinely ambiguous) are excluded, so this set is "cleaner/easier" than the full CVE population.
  • Roll-up to View-1003 discards sub-View-1003 specificity (variant-level CWEs map to their base).
  • English only.
  • Not a substitute for analyst review on novel or complex vulnerabilities.

License & attribution

Released under CC BY 4.0. The dataset derives from public sources; please also honor their terms:

  • NVD (NIST) — U.S. Government work, public domain.
  • CVE Program / cvelistV5 — © the CVE Program; CVE Records are free to use with attribution.
  • MITRE CWE — © The MITRE Corporation; free to use with attribution.

CWE™ and CVE® are trademarks of The MITRE Corporation.

Citation

@misc{cve_cwe_consensus_2026,
  title        = {CVE-to-CWE Consensus Dataset},
  author       = {exploitintel},
  year         = {2026},
  howpublished = {Hugging Face Hub},
  url          = {https://huggingface.co/datasets/exploitintel/cve-cwe-consensus}
}