This model is a fine-tuned version of Qwen2.5-Coder-7B-Instruct, specialized in generating Nuclei YAML templates for vulnerability detection. It was created as part of a bachelor’s thesis on automating Nuclei template creation using large language models.
The model receives a structured JSON description of a vulnerability (CVE ID, affected product, protocol details, exploitation summary, detection logic, etc.) and outputs a fully valid Nuclei template ready for use with the Nuclei scanner. It has been trained to follow the exact syntax of Nuclei templates, including proper HTTP request definitions, matchers, extractors, and OAST (Interactsh) integration.
Fine-tuned by: NormanRey;
Model type: Causal language model fine-tuned with instruction tuning;
The model is intended to be used directly for generating Nuclei templates from vulnerability descriptions. It can be integrated into security automation pipelines, threat intelligence platforms, or used by penetration testers to quickly create detection rules for newly disclosed CVEs.
Downstream Use
When further fine-tuned on additional vulnerability classes (e.g., DNS, TCP, JavaScript), the model could cover the full Nuclei template ecosystem. The adapter weights can be merged with newer versions of Qwen-Coder for continuous improvement.
Out-of-Scope Use
The model should not be used for:
Generating offensive payloads or exploit code;
Any malicious activity not related to authorized security testing;
Producing templates for CVEs that require complex multi-step authentication flows without proper validation.
Bias, Risks, and Limitations
The model was trained on a dataset of 2350 unique HTTP-based Nuclei templates. As a result, it may:
Perform poorly on non-HTTP protocols (DNS, TCP, etc.);
Occasionally produce syntactically correct but logically flawed matchers;
Generate templates that require minor manual corrections (e.g., quoting strings with colons).
Recommendations
Always validate generated templates with nuclei -validate and, where possible, test them against known vulnerable instances. The model is a powerful assistant but not a replacement for human review.
Example of output
Generated template for CVE-2023-43654:
yaml
1id: CVE-2023-436542info:3name: PyTorch TorchServe - Server-Side Request Forgery (SSRF)
4author: nuclei-generator
5severity: high
6description: 'PyTorch TorchServe versions from 0.1.0 to 0.8.1 are vulnerable to server-side
7 request forgery (SSRF) via unrestricted model URL loading.
89 '
10impact: 'Unauthenticated attackers can exploit SSRF vulnerabilities in PyTorch
11 TorchServe to access internal resources, potentially leading to data leakage,12 unauthorized access, or remote code execution.
1314 '
15remediation: 'Upgrade to PyTorch TorchServe version 0.8.2 or later that restricts
16 allowed URLs and validates model definitions before downloading them.
1718 '
19reference:20- https://huntr.com/bounties/1695374e-6c7a-4b3d-bf96-000000000000/
21- https://nvd.nist.gov/vuln/detail/CVE-2023-4365422classification:23cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N
24cvss-score:8.625cve-id: CVE-2023-4365426epss-score:0.9474327epss-percentile:0.9991928cwe-id: CWE-91829metadata:30verified:true31max-request:132shodan-query: http.title:"TorchServe"33tags: cve,cve2023,pytorch,torchserve,oast,ssrf,vkev,vuln
34http:35-raw:36- 'POST /models?url=http://{{interactsh-url}} HTTP/1.1
3738Host:{{Hostname}}3940Content-Type: application/x-www-form-urlencoded
414243 '
44matchers-condition: and
45matchers:46-type: word
47part: interactsh_protocol
48words:49- http
50-type: word
51part: interactsh_request
52words:53-"User-Agent: Java"54-type: word
55part: header
56name: content-type
57words:58- application/json
1You are a Nuclei template generator.
2Return only valid YAML for a single Nuclei template.
34MANDATORY RULES (MUST FOLLOW)
5 - The path MUST be taken EXACTLY from request_shape.primary_path.
6 - DO NOT modify, generalize, or replace paths (no variables like {{BaseURL}}/api/ except the original one).
7 - DO NOT introduce additional endpoints not present in input.
8 - If auth_required is false → DO NOT add any login, session, or credential requests.
9 - Do not inject cookies or headers that imply authentication unless explicitly specified.
10 - The number of HTTP requests MUST match template_context.flow (e.g., "single-step" → one request).
11 - Prefer copying the provided description verbatim instead of rewriting.
12 - Keep all metadata (name, severity, classification, etc.) under the "info" block.
13 - Do not omit existing query parameters described in exploitation_summary or request_shape.
14 - Output YAML only – no explanations, no markdown, no extra text.
15 - You MAY use matchers of type "word" or "status" for simple checks (e.g., single word, fixed status code).
16 - For complex conditions (OR / AND across multiple indicators, combined checks on status + body + header), you MUST use a SINGLE matcher of type "dsl".
17 - Put all required expressions inside the "dsl" array.
18 - Use "condition: and" or "condition: or" as needed.
19 - Examples of DSL expressions:
20 - status_code == 200
21 - contains(body, "secret")
22 - contains_all(body, "admin", "config")
23 - contains(to_lower(body), "error")
24 - len(body) > 100
25 - Keep matchers deterministic – avoid regex if a simple word/contains works.
26 - Use the exact Nuclei schema.
27 - Do not invent fields.
28 - "http" must be a top-level block.
29 - Use "raw" requests only if needed for exploit templates; otherwise prefer "http" with method + path.
3031Generate the YAML template based on the instruction and input below.
32Do not deviate from the rules above.
Using with Ollama (Local Inference)
You can convert this model to GGUF format for Ollama and then use it.
Pull and run:
bash
1ollama create qwen-7b-nuclei -f Modelfile
2ollama run qwen-7b-nuclei
It contains 2350 training examples, each consisting of:
instruction: A fixed prompt instructing the model to generate a Nuclei template;
input: A JSON object describing a specific vulnerability (CVE ID, protocol, path, exploitation details, etc.), generated by a summarization LLM from the reference links of the original template;
output: The corresponding valid Nuclei YAML template.
Dataset Construction Pipeline
The dataset was constructed via an automated pipeline that:
Parsed approximately 6360 HTTP-based Nuclei templates from five categories:
CVEs;
Exposures;
Misconfigurations;
Miscellaneous;
Vulnerabilities.
Fetched and cleaned the textual content of external references:
Security advisories;
Exploit-DB pages;
NVD entries.
Used an LLM summarizer to convert the collected information and original YAML templates into a normalized JSON vulnerability specification.
Applied an LLM-as-a-Judge filtering stage, retaining only examples with an average score of 7.0 or higher for:
Technical completeness;
Alignment with the original template;
Reconstruction sufficiency.
Deduplicated the resulting dataset and split it into:
Train: 80%;
Validation: 10%;
Test: 10%.
Training Procedure
The model was fine-tuned using Weight-Decomposed Low-Rank Adaptation (DoRA) without 4-bit quantization (full bfloat16 precision) on an NVIDIA A100 80 GB GPU.
Preprocessing
Each example was formatted into a chat-style structure:
Evaluation was conducted on a held-out test set of 25 CVEs that were not included during training.
Each test sample was paired with its corresponding original template from the official Nuclei repository.
Evaluation Metrics
Three custom metrics were scored by an LLM-as-a-Judge (GPT-5.4-mini) on a scale from 0 to 10:
Structural Integrity
Measures:
YAML syntactic correctness;
Presence of mandatory sections;
Overall template structure.
Detection Fidelity
Measures:
Accuracy of generated HTTP requests;
Correctness of matchers;
OAST interaction logic;
Similarity to the original template detection workflow.
Metadata Completeness
Measures:
CVE identifiers;
Severity information;
References;
Tags and auxiliary metadata.
Additional Validation
All generated templates were validated using:
nuclei -validate
with pass/fail reporting.
Results
Model
Structural Integrity
Detection Fidelity
Metadata Completeness
Nuclei Validation Rate
Qwen2.5-Coder-7B-Instruct-Nuclei
6.08
2.56
4.84
96% (24/25)
Qwen2.5-Coder-3B-Instruct-Nuclei
3.92
1.56
3.20
16% (4/25)
ChatGPT-5.4
5.76
2.12
4.24
64% (16/25)
Qwen2.5-Coder-7B-Instruct
1.92
1.04
2.60
0% (0/25)
Qwen2.5-Coder-3B-Instruct
2.20
0.96
1.80
0% (0/25)
The fine-tuned model significantly outperforms its base version and compares favorably with commercial general-purpose models, particularly in:
Detection fidelity;
Template validity;
Nuclei validation success rate.
Summary
The model effectively automates the generation of syntactically valid and functionally accurate Nuclei templates from structured vulnerability descriptions.
It can serve as a practical assistant for:
Security researchers;
Penetration testers;
Vulnerability analysts;
Detection engineers.
Environmental Impact
Metric
Value
Hardware
NVIDIA A100 (40x2) GB
Usage Time
1.5 hours
Cloud Provider
Google Colab
Technical Specifications
Model Architecture and Objective
The model uses the same architecture as Qwen2.5-Coder-7B-Instruct, a decoder-only Transformer.
Training objective:
Causal Language Modeling (CLM);
Loss computed exclusively on the response tokens.
Compute Infrastructure
Hardware
Training
1 × NVIDIA A100 80 GB GPU
40 GB system RAM
Inference
The model can run on:
On a GPU with 8-16 GB: using 4-bit GGUF quantization;
On a GPU with more than 16 GB: just convert to GGUF without quantization.