How to use from the
Use from the
Transformers.js library
// npm i @huggingface/transformers
import { pipeline } from '@huggingface/transformers';

// Allocate pipeline
const pipe = await pipeline('text-classification', 'Project-Bastion/attack-technique-tagger');

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: 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

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).

Downloads last month
82
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Project-Bastion/attack-technique-tagger

Quantized
(3)
this model

Space using Project-Bastion/attack-technique-tagger 1

Evaluation results