How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-classification", model="PentesterFlow/xss-decision")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("PentesterFlow/xss-decision", device_map="auto")
Quick Links
xss-decision β€” AI-Powered XSS Detection

XSS Decision Model β€” Kev 0.8B Live v2

A 0.8B parameter Small Language Model (SLM) fine-tuned for real-time XSS (Cross-Site Scripting) vulnerability decision-making. This is a LoRA adapter on top of Qwen/Qwen3.5-0.8B-Base, trained using the Kev typed-decision framework.

What It Does

The model makes 5 types of XSS assessment decisions in real-time:

Task Question Description
triage exploitable? Should this URL/parameter combination be probed for XSS?
analyze true_context What is the actual injection context? (html_text, html_attr, js_string, dom_html, etc.)
interpret exploitable? Given reflection evidence, is this actually exploitable?
strategy best_probe Which XSS probe technique should be tried?
escalate escalation What escalation technique to try next? (evasion, mXSS, CSP bypass)

Held-out Test Accuracy

Evaluated on 57 held-out records (never seen during training):

Task Question Accuracy
analyze has_sanitizer 100% (21/21)
analyze true_context 95.2% (20/21)
interpret exploitable 100% (7/7)
escalate escalation 100% (2/2)
strategy best_probe 75% (3/4)
triage exploitable 78.3% (18/23)

Pipeline Integration Results (XSS-LiveBench-v2)

When integrated into the xss-specialist live assessment pipeline β€” 225 cases:

Metric Value 95% Bootstrap CI
Precision 1.000 [1.000, 1.000]
Recall 1.000 [1.000, 1.000]
FPR 0.000 [0.000, 0.000]
FNR 0.000 [0.000, 0.000]
Confirmed-exec accuracy 1.000 [1.000, 1.000]
Near-miss leakage 0.000 β€”

Confusion matrix: TP=157 Β· FP=0 Β· FN=0 Β· TN=68

By XSS class

Class Cases Recall
Reflected 75 100%
DOM 78 100%
Stored 4 100%
Safe (negative) 68 0 FP

By injection context

Context Cases Accuracy
html_text 83 100%
dom_html 81 100%
html_attr 22 100%
js_code 22 100%
js_string 8 100%
html_attr_url 5 100%
css 3 100%
dom_attr 1 100%

By category (25 categories β€” all 100%)

reflected (37) Β· owasp_evasion (24) Β· sanitizer_nearmiss (21) Β· csp_bypass (20) Β· fp_torture (16, 0 FP) Β· dom (15) Β· modern_controls (12) Β· advanced_delivery (8) Β· dom_source (7) Β· event_driven (7) Β· encoding_chain (6) Β· framework_sink (6) Β· svg_xss (6) Β· encoding (5) Β· postmessage (5) Β· proto_pollution (5) Β· sanitizer (5) Β· mxss (4) Β· dom_clobbering (3) Β· script_gadget (3) Β· template_injection (3) Β· second_order (2) Β· stored (2) Β· websocket (2) Β· dom_multistep (1)

Live XSS Lab β€” 10 Independent Scenarios

# Scenario Context Status
1 Basic reflected XSS html_attr CONFIRMED
2 Reflected in HTML body html_text CONFIRMED
3 DOM-based XSS (innerHTML) dom_html CONFIRMED
4 Attribute injection html_attr CONFIRMED
5 JS string injection (multi-context) js_string CONFIRMED
6 Unquoted attribute injection html_attr CONFIRMED
7 <script> filter bypass html_attr CONFIRMED
8 Event handler injection html_attr CONFIRMED
9 Encoded reflection bypass html_attr CONFIRMED
10 Mutation XSS (mXSS) js_string CONFIRMED

Baseline Comparison

Approach Precision Recall FPR Note
xss-specialist (full) 1.000 1.000 0.000 Browser-oracle verified
Nuclei (signature-based) N/A 0.000 0.000 Zero recall on custom endpoints
Reflection-only scanner 0.62 0.95 0.97 Flags anything that echoes
Encoding-aware scanner 0.87 0.41 0.11 Checks if dangerous chars survive

How to Use

# Requires the kev package (Python 3.12/3.13)
# pip install "kev @ git+https://github.com/jaredpalmer/kev.git"

from xss_decision.learned import LearnedBackend

backend = LearnedBackend("path/to/checkpoint", device="mps")  # or "cuda", "cpu"

# Triage decision
result = backend.predict({
    "state": {
        "task": "triage",
        "url": "/search",
        "parameter": "q",
        "delivery": "query",
        "context": "html_text",
        "method": "GET"
    },
    "questions": {
        "exploitable": {
            "type": "noul",
            "criteria": {
                "true": "High likelihood of reflection into a dangerous context",
                "false": "Low likelihood β€” encoded, filtered, or structural param"
            }
        }
    }
})
print(result["probabilities"])
# {"exploitable": {"true": 0.854, "false": 0.146}}

Use with the Live Scanner

# Install
uv sync
uv run python -m playwright install chromium

# Run with the trained model
uv run python -m live.assess --target http://authorized-target.com --kev runs/kev-xss-v2/checkpoint

Training Details

Parameter Value
Base model Qwen/Qwen3.5-0.8B-Base
Parent checkpoint jaredpalmer/kev-0.8b
Adapter LoRA (rank 16, full placement)
Trainable parameters 11.3M
Training records 528 (from XSS-LiveBench-v2 execution-verified run)
Typed decisions 582
Epochs 3
Learning rate 1e-5
Batch size 4 (accumulation 2)
Optimizer steps 159
Precision fp32
Device Apple MPS
Training time 1213s (~20 min)
Permutation KL 0.1 (option-order stability regularization)

Training Data

528 records exported from a perfect-score XSS-LiveBench-v2 run (225 cases, P=1.0, R=1.0, FPR=0.0). Each record represents a real decision the pipeline made during live XSS assessment, with execution-verified ground truth from the headless Chromium browser oracle.

Task distribution: triage (221), analyze (203), interpret (63), strategy (29), escalate (12).

Architecture

This is a Kev typed-decision model β€” a pointer-network head on a Mamba2/transformer hybrid backbone. Unlike autoregressive text generation, it produces calibrated probability distributions over structured decision options in a single forward pass (~242ms on Apple MPS).

Qwen3.5-0.8B-Base (frozen)
  └── LoRA adapters (rank 16, all projections)
       └── Kev pointer head (dim 256)
            └── Per-question probability distributions

Limitations

  • Research preview β€” not independently validated for production use
  • Training data is synthetic benchmark-derived β€” may not generalize to all real-world XSS patterns
  • A "safe" prediction is not proof of safety β€” always verify with browser execution
  • Near-miss sanitizer leakage β€” the model alone cannot reliably distinguish DOMPurify from DOMPvrify; the full pipeline handles this via execution verification
  • No blind/out-of-band XSS β€” training data covers reflected, DOM, and stored XSS only
  • Chromium-specific β€” browser oracle ground truth is Chromium-based

Ethical Use

This model is intended for authorized security testing only. All assessment paths require explicit scope and authorization. The model should be used as part of a defensive security workflow, not for unauthorized testing.

License

Apache-2.0 (adapter and pointer head). The base model (Qwen3.5-0.8B-Base) is also Apache-2.0.

Framework versions

  • PEFT 0.22.0
  • Kev 0.1.0
  • PyTorch 2.x
  • Transformers 4.x
Downloads last month
38
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for PentesterFlow/xss-decision

Adapter
(69)
this model