Text Classification
PEFT
Safetensors
Transformers
English
lora
security
xss
vulnerability-detection
cybersecurity
web-security
Instructions to use PentesterFlow/xss-decision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use PentesterFlow/xss-decision with PEFT:
from peft import PeftModel from transformers import AutoModel base_model = AutoModel.from_pretrained("Qwen/Qwen3.5-0.8B-Base") model = PeftModel.from_pretrained(base_model, "PentesterFlow/xss-decision") - Transformers
How to use PentesterFlow/xss-decision with Transformers:
# 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") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from PentesterFlow/xss-decision: direct link, hf CLI and curl.
- Browser
- Download file 8.1 kB
-
https://huggingface.co/PentesterFlow/xss-decision/resolve/main/README.md
- Command line
-
hf download hf://PentesterFlow/xss-decision/README.md
-
curl -L -o README.md https://huggingface.co/PentesterFlow/xss-decision/resolve/main/README.md
8.1 kB
| base_model: Qwen/Qwen3.5-0.8B-Base | |
| library_name: peft | |
| license: apache-2.0 | |
| tags: | |
| - base_model:adapter:Qwen/Qwen3.5-0.8B-Base | |
| - lora | |
| - transformers | |
| - security | |
| - xss | |
| - vulnerability-detection | |
| - cybersecurity | |
| - web-security | |
| language: | |
| - en | |
| pipeline_tag: text-classification | |
| <div align="center"> | |
| <img src="assets/banner.png" alt="xss-decision — AI-Powered XSS Detection" width="100%"> | |
| </div> | |
| # 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](https://github.com/jaredpalmer/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 | |
| ```python | |
| # 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 | |
| ```bash | |
| # 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 | |