Project-Bastion's picture
Update model card
c639544 verified
|
Raw History Blame Contribute Delete
4.15 kB
---
license: apache-2.0
base_model: cisco-ai/SecureBERT2.0-base
pipeline_tag: text-classification
library_name: transformers
language: [en]
tags: [mitre-attack, cyber-threat-intelligence, cti, multi-label, security, ttp, onnx, transformers.js, threat-intelligence, soc, detection-engineering, attack, text-classification]
model-index:
- name: attack-technique-tagger
results:
- task: {type: text-classification, name: ATT&CK technique tagging (multi-label, 50 techniques)}
dataset: {type: tram2-report-split-test, name: TRAM2 test (26 reports, 2920 sentences)}
metrics:
- {type: f1, value: 0.593, name: micro F1}
- {type: f1, value: 0.537, name: macro F1}
- {type: f1, value: 0.730, name: any-technique detection F1}
inference: false
---
# attack-technique-tagger
Tag a sentence from a threat report with the MITRE ATT&CK techniques it describes (50 techniques, multi-label). It beats the best open ATT&CK tagger I found (TTPXHunter) by a wide margin on TRAM2 and runs on CPU or in your browser with no server.
**[Try it in your browser](https://huggingface.co/spaces/Project-Bastion/attack-technique-tagger-demo)**: a static page that runs the model locally (transformers.js, ONNX). The text you paste never leaves your device.
## Results
TRAM2 annotated threat-report sentences (Center for Threat-Informed Defense): test split of 26 reports, 2,920 sentences, 683 labelled with at least one technique; 50 techniques. One number per cell: the score on that benchmark.
| System | Micro F1 | Macro F1 | "has any technique" F1 |
|---|---|---|---|
| **attack-technique-tagger** | **0.593** | **0.537** | **0.730** |
| nanda-rani/TTPXHunter (off the shelf, scored on the same 50 techniques) | 0.296 | 0.243 | 0.499 |
| TF-IDF + logistic regression | 0.536 | 0.496 | 0.672 |
Micro precision / recall of this model: 0.595 / 0.590.
## Usage
```python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
repo = "Project-Bastion/attack-technique-tagger"
tok = AutoTokenizer.from_pretrained(repo); model = AutoModelForSequenceClassification.from_pretrained(repo).eval()
sentences = ["The malware dumps credentials from LSASS memory using a Mimikatz-like routine.",
"It then creates a scheduled task to maintain persistence on the host.",
"Command and control traffic is sent over HTTPS to a hard-coded domain."] # sentences of ONE report, in order
def tag(i, threshold=0.2):
prev = sentences[i - 1] if i > 0 else ""; nxt = sentences[i + 1] if i + 1 < len(sentences) else ""
ctx = prev[-300:] + " | " + nxt[:300] # neighbouring sentences are part of the input
enc = tok(sentences[i], ctx, truncation="longest_first", max_length=256, return_tensors="pt")
with torch.no_grad(): p = torch.sigmoid(model(**enc).logits[0])
return [(model.config.id2label[j], round(float(p[j]), 3)) for j in torch.nonzero(p >= threshold).flatten().tolist()]
for i, s in enumerate(sentences): print(s[:60], "->", tag(i))
```
Input is the sentence plus its previous and next sentence from the same report; outputs are independent sigmoids over 50 technique ids (see `config.json`; look any id up at `attack.mitre.org/techniques/<ID>`). Raise the 0.2 threshold for fewer false positives.
## Files
`onnx/model.onnx` (fp32, 599 MB) and `onnx/model_quantized.onnx` (weight-only int8, 151 MB, the demo default) for transformers.js / onnxruntime. int8 can add or drop a low-confidence tag near the threshold; use the fp32 file for exact agreement with the Python reference.
## Limits
* Covers the 50 TRAM2 techniques only, and is English-only and sentence-level: review its tags as suggestions.
* Trained on threat-report prose; use other text such as logs or alerts only after checking it on your own samples.
## License and credits
Apache-2.0. Base model: cisco-ai/SecureBERT2.0-base (Apache-2.0). Training data: TRAM2 data from the Center for Threat-Informed Defense TRAM project (Apache-2.0), derived from public threat reports labelled with MITRE ATT&CK techniques (ATT&CK is a trademark of The MITRE Corporation; use per the ATT&CK Terms of Use).