cedricbonhomme commited on
Commit
4bd1d03
·
verified ·
1 Parent(s): 40ad73e

Complete the model card: evaluation vs zero-shot baseline, intended use, next steps

Browse files
Files changed (1) hide show
  1. README.md +117 -16
README.md CHANGED
@@ -2,39 +2,131 @@
2
  library_name: transformers
3
  license: mit
4
  base_model: roberta-base
 
 
 
 
 
5
  tags:
 
 
 
 
 
 
6
  - generated_from_trainer
7
  model-index:
8
  - name: vulnerability-attack-technique-classification-roberta-base
9
  results: []
10
  ---
11
 
12
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
- should probably proofread and complete it, then remove this comment. -->
14
-
15
  # vulnerability-attack-technique-classification-roberta-base
16
 
17
- This model is a fine-tuned version of [roberta-base](https://huggingface.co/roberta-base) on an unknown dataset.
18
- It achieves the following results on the evaluation set:
19
- - Loss: 0.6205
20
- - F1 Micro: 0.4171
21
- - F1 Macro: 0.2027
22
- - Precision Micro: 0.3005
23
- - Recall Micro: 0.6818
24
- - Recall At 3: 0.4822
25
- - Recall At 5: 0.6859
26
 
27
- ## Model description
 
28
 
29
- More information needed
 
 
 
30
 
31
  ## Intended uses & limitations
32
 
33
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  ## Training and evaluation data
36
 
37
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  ## Training procedure
40
 
@@ -49,6 +141,8 @@ The following hyperparameters were used during training:
49
  - lr_scheduler_type: linear
50
  - num_epochs: 40
51
 
 
 
52
  ### Training results
53
 
54
  | Training Loss | Epoch | Step | Validation Loss | F1 Micro | F1 Macro | Precision Micro | Recall Micro | Recall At 3 | Recall At 5 |
@@ -101,3 +195,10 @@ The following hyperparameters were used during training:
101
  - Pytorch 2.12.1+cu130
102
  - Datasets 4.8.5
103
  - Tokenizers 0.22.2
 
 
 
 
 
 
 
 
2
  library_name: transformers
3
  license: mit
4
  base_model: roberta-base
5
+ pipeline_tag: text-classification
6
+ language:
7
+ - en
8
+ datasets:
9
+ - CIRCL/vulnerability-attack-techniques
10
  tags:
11
+ - vulnerability
12
+ - cybersecurity
13
+ - security
14
+ - cve
15
+ - mitre-attack
16
+ - attack-techniques
17
  - generated_from_trainer
18
  model-index:
19
  - name: vulnerability-attack-technique-classification-roberta-base
20
  results: []
21
  ---
22
 
 
 
 
23
  # vulnerability-attack-technique-classification-roberta-base
24
 
25
+ This model suggests **MITRE ATT&CK (Enterprise) techniques** from a vulnerability
26
+ description. It is a fine-tuned version of
27
+ [roberta-base](https://huggingface.co/roberta-base) trained on
28
+ [CIRCL/vulnerability-attack-techniques](https://huggingface.co/datasets/CIRCL/vulnerability-attack-techniques),
29
+ a dataset of ~1,200 CVEs with analyst-curated technique mappings from the
30
+ [MITRE Center for Threat-Informed Defense (CTID)](https://ctid.mitre.org/) projects,
31
+ following the "Mapping ATT&CK to CVE for Impact" methodology.
 
 
32
 
33
+ CVSS tells you *how bad* a vulnerability is, CWE *what kind of flaw* it is —
34
+ ATT&CK tells defenders *what adversary behavior to expect and detect*.
35
 
36
+ This is a **multi-label** classifier (sigmoid head, binary cross-entropy with
37
+ per-label positive weights): a CVE legitimately maps to several techniques —
38
+ an exploitation technique (e.g. T1190 *Exploit Public-Facing Application*)
39
+ plus one or more impacts (e.g. T1059 *Command and Scripting Interpreter*).
40
 
41
  ## Intended uses & limitations
42
 
43
+ The model **suggests candidate techniques for analyst review**. It must not be
44
+ treated as an authoritative mapping: a CVE description describes a flaw, while
45
+ ATT&CK describes attacker behavior around it, and even human annotators
46
+ disagree on such mappings. Use the top-k suggestions as a triage aid.
47
+
48
+ - **Label space**: 57 parent techniques (sub-techniques collapsed, only
49
+ techniques with ≥ 5 training examples), enterprise ATT&CK v19.1. Techniques
50
+ outside this vocabulary can never be suggested.
51
+ - **Selection bias**: the training data over-represents exploited-in-the-wild
52
+ vulnerabilities (a large part comes from CISA KEV mappings).
53
+ - **Small training set** (~1,100 examples): rare-technique performance is
54
+ weak, as the macro-F1 shows.
55
+
56
+ ## Evaluation
57
+
58
+ Evaluated with `vulntrain-validate-attack-classification` on the dataset's
59
+ test split, against the zero-shot SMET-style baseline (rank techniques by
60
+ cosine similarity between the description embedding —
61
+ `all-MiniLM-L6-v2` — and the official ATT&CK technique descriptions), using
62
+ the same label vocabulary and metrics:
63
+
64
+ | Metric | Zero-shot similarity baseline | This model |
65
+ |--------|------------------------------|------------|
66
+ | recall@1 | 0.118 | **0.220** |
67
+ | recall@3 | 0.257 | **0.482** |
68
+ | recall@5 | 0.322 | **0.686** |
69
+ | recall@10 | 0.491 | **0.842** |
70
+ | MRR | 0.397 | **0.620** |
71
+
72
+ At the 0.5 threshold: F1 micro 0.417, F1 macro 0.203, precision micro 0.301,
73
+ recall micro 0.682. The balanced positive weights deliberately favor recall;
74
+ for the suggestion use case, ranking metrics (recall@k) are the ones that
75
+ matter — in ~69% of cases the correct techniques appear among the top 5
76
+ suggestions, out of 57 candidates.
77
+
78
+ ## Usage
79
+
80
+ ```python
81
+ import torch
82
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
83
+
84
+ model_id = "CIRCL/vulnerability-attack-technique-classification-roberta-base"
85
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
86
+ model = AutoModelForSequenceClassification.from_pretrained(model_id)
87
+
88
+ description = (
89
+ "A Missing Authentication for Critical Function vulnerability in J-Web "
90
+ "allows an unauthenticated, network-based attacker to upload and "
91
+ "download arbitrary files and execute commands."
92
+ )
93
+ inputs = tokenizer(description, return_tensors="pt", truncation=True)
94
+ with torch.no_grad():
95
+ probabilities = torch.sigmoid(model(**inputs).logits)[0]
96
+
97
+ top = torch.topk(probabilities, k=5)
98
+ for probability, index in zip(top.values, top.indices):
99
+ print(f"{model.config.id2label[index.item()]}: {probability:.2f}")
100
+ ```
101
 
102
  ## Training and evaluation data
103
 
104
+ Trained with [VulnTrain](https://github.com/vulnerability-lookup/VulnTrain):
105
+
106
+ ```bash
107
+ vulntrain-train-attack-classification \
108
+ --base-model roberta-base \
109
+ --repo-id CIRCL/vulnerability-attack-technique-classification-roberta-base
110
+ ```
111
+
112
+ The dataset provenance (why the labels come from the hand-curated CTID
113
+ mappings rather than automatically derived CVE→CWE→CAPEC→ATT&CK chains) is
114
+ documented in the
115
+ [methodology page](https://github.com/vulnerability-lookup/VulnTrain/blob/main/docs/attack-techniques-dataset.md)
116
+ and on the [dataset card](https://huggingface.co/datasets/CIRCL/vulnerability-attack-techniques).
117
+
118
+ ## Next steps
119
+
120
+ - **LLM-assisted label expansion**: grow the training set beyond ~1,200
121
+ examples by labeling a CWE-stratified CVE sample with the CTID methodology,
122
+ validated against the analyst gold set before use. This targets the main
123
+ weakness (rare-technique recall / macro-F1).
124
+ - Stronger encoders (e.g. security-domain sentence models) as both baseline
125
+ and base model.
126
+ - Sub-technique-level labels once the per-label support allows it
127
+ (`--keep-subtechniques`).
128
+ - Integration into [Vulnerability-Lookup](https://vulnerability.circl.lu) via
129
+ [ML-Gateway](https://github.com/vulnerability-lookup/ML-Gateway).
130
 
131
  ## Training procedure
132
 
 
141
  - lr_scheduler_type: linear
142
  - num_epochs: 40
143
 
144
+ The best checkpoint was selected on validation macro-F1 (epoch 33).
145
+
146
  ### Training results
147
 
148
  | Training Loss | Epoch | Step | Validation Loss | F1 Micro | F1 Macro | Precision Micro | Recall Micro | Recall At 3 | Recall At 5 |
 
195
  - Pytorch 2.12.1+cu130
196
  - Datasets 4.8.5
197
  - Tokenizers 0.22.2
198
+
199
+ ## References
200
+
201
+ - [Vulnerability-Lookup](https://vulnerability.circl.lu) — the vulnerability data source
202
+ - [VulnTrain](https://github.com/vulnerability-lookup/VulnTrain) — training pipeline
203
+ - [MITRE CTID attack_to_cve](https://github.com/center-for-threat-informed-defense/attack_to_cve) and [Mappings Explorer](https://center-for-threat-informed-defense.github.io/mappings-explorer/) — label sources
204
+ - MITRE ATT&CK® is a registered trademark of The MITRE Corporation; content used per the [terms of use](https://attack.mitre.org/resources/legal-and-branding/terms-of-use/)