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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gpl-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- cybersecurity
|
| 7 |
+
- software-security
|
| 8 |
+
- vulnerability-detection
|
| 9 |
+
- java
|
| 10 |
+
- code-classification
|
| 11 |
+
- llm
|
| 12 |
+
- fine-tuning
|
| 13 |
+
task_categories:
|
| 14 |
+
- text-classification
|
| 15 |
+
- text-generation
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# OWASP Benchmark Java – LLM Fine-Tuning Dataset
|
| 19 |
+
|
| 20 |
+
A chat-formatted dataset derived from the **OWASP Benchmark for Java** and prepared for large language model fine-tuning for Java vulnerability detection.
|
| 21 |
+
|
| 22 |
+
## Dataset Summary
|
| 23 |
+
|
| 24 |
+
This dataset contains **21,041 Java security analysis examples** derived from OWASP Benchmark test cases.
|
| 25 |
+
|
| 26 |
+
Each example contains:
|
| 27 |
+
|
| 28 |
+
- A system instruction describing the security analysis task
|
| 29 |
+
- A Java source-code sample
|
| 30 |
+
- An assistant response containing:
|
| 31 |
+
- `vulnerable`: vulnerability presence (`true` / `false`)
|
| 32 |
+
- `cwe`: CWE identifier
|
| 33 |
+
- `category`: vulnerability category
|
| 34 |
+
|
| 35 |
+
The data is formatted using the `messages` structure commonly used for conversational and instruction fine-tuning.
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
|
| 39 |
+
| Split | Examples |
|
| 40 |
+
|---|---:|
|
| 41 |
+
| Train | 16,849 |
|
| 42 |
+
| Validation | 2,096 |
|
| 43 |
+
| Test | 2,096 |
|
| 44 |
+
| **Total** | **21,041** |
|
| 45 |
+
|
| 46 |
+
## Example
|
| 47 |
+
|
| 48 |
+
```json
|
| 49 |
+
{
|
| 50 |
+
"messages": [
|
| 51 |
+
{
|
| 52 |
+
"role": "system",
|
| 53 |
+
"content": "You are a Java application security analyzer..."
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"role": "user",
|
| 57 |
+
"content": "Analyze the following Java source code..."
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"role": "assistant",
|
| 61 |
+
"content": "{\"vulnerable\": true, \"cwe\": \"CWE-501\", \"category\": \"trustbound\"}"
|
| 62 |
+
}
|
| 63 |
+
]
|
| 64 |
+
}
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Labels
|
| 68 |
+
|
| 69 |
+
The dataset contains the following CWE categories:
|
| 70 |
+
|
| 71 |
+
- CWE-22 – Path Traversal
|
| 72 |
+
- CWE-78 – OS Command Injection
|
| 73 |
+
- CWE-79 – Cross-Site Scripting
|
| 74 |
+
- CWE-89 – SQL Injection
|
| 75 |
+
- CWE-90 – LDAP Injection
|
| 76 |
+
- CWE-327 – Broken/Risky Cryptographic Algorithm
|
| 77 |
+
- CWE-328 – Weak Hashing
|
| 78 |
+
- CWE-330 – Weak Randomness
|
| 79 |
+
- CWE-501 – Trust Boundary Violation
|
| 80 |
+
- CWE-614 – Sensitive Cookie Without 'Secure' Flag
|
| 81 |
+
- CWE-643 – XPath Injection
|
| 82 |
+
|
| 83 |
+
The primary binary classification target is:
|
| 84 |
+
|
| 85 |
+
```text
|
| 86 |
+
vulnerable = true / false
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Intended Use
|
| 90 |
+
|
| 91 |
+
The dataset is intended for:
|
| 92 |
+
|
| 93 |
+
- Java source-code vulnerability detection
|
| 94 |
+
- Security-focused LLM fine-tuning
|
| 95 |
+
- Research on code security classification
|
| 96 |
+
- Evaluation of vulnerability-aware language models
|
| 97 |
+
- CWE classification experiments
|
| 98 |
+
|
| 99 |
+
## Data Source
|
| 100 |
+
|
| 101 |
+
The underlying source is the **OWASP Benchmark for Java**, an open-source benchmark designed to evaluate the accuracy, coverage, and speed of software vulnerability detection tools.
|
| 102 |
+
|
| 103 |
+
The OWASP Benchmark project states that its test cases contain intentionally vulnerable and non-vulnerable examples mapped to specific CWEs.
|
| 104 |
+
|
| 105 |
+
Source project:
|
| 106 |
+
|
| 107 |
+
https://github.com/OWASP-Benchmark/BenchmarkJava
|
| 108 |
+
|
| 109 |
+
Project information:
|
| 110 |
+
|
| 111 |
+
https://owasp.org/www-project-benchmark/
|
| 112 |
+
|
| 113 |
+
## Dataset Preparation
|
| 114 |
+
|
| 115 |
+
The original OWASP Benchmark Java examples were transformed into a conversational JSONL format suitable for LLM fine-tuning.
|
| 116 |
+
|
| 117 |
+
The transformation:
|
| 118 |
+
|
| 119 |
+
1. Extracted the Java source code from each benchmark test.
|
| 120 |
+
2. Associated each example with its corresponding CWE.
|
| 121 |
+
3. Preserved the vulnerable/non-vulnerable label.
|
| 122 |
+
4. Preserved the vulnerability category.
|
| 123 |
+
5. Converted each example into a `system / user / assistant` message structure.
|
| 124 |
+
6. Created train, validation and test splits.
|
| 125 |
+
|
| 126 |
+
No model-generated labels were used.
|
| 127 |
+
|
| 128 |
+
## Split
|
| 129 |
+
|
| 130 |
+
The dataset contains:
|
| 131 |
+
|
| 132 |
+
- `train.jsonl`
|
| 133 |
+
- `validation.jsonl`
|
| 134 |
+
- `test.jsonl`
|
| 135 |
+
|
| 136 |
+
The current split contains approximately 80% training data, 10% validation data and 10% test data.
|
| 137 |
+
|
| 138 |
+
### Distribution
|
| 139 |
+
|
| 140 |
+
The CWE distribution is approximately consistent across the three splits.
|
| 141 |
+
|
| 142 |
+
The vulnerable/non-vulnerable distribution is also approximately consistent across the splits.
|
| 143 |
+
|
| 144 |
+
## Important Note About Benchmark Similarity
|
| 145 |
+
|
| 146 |
+
OWASP Benchmark is a synthetic security benchmark containing many test cases based on common Java application structures and vulnerability patterns.
|
| 147 |
+
|
| 148 |
+
Consequently, structurally similar source-code examples may occur across different splits.
|
| 149 |
+
|
| 150 |
+
This dataset should therefore be interpreted as an OWASP Benchmark-based fine-tuning dataset rather than as a leakage-controlled real-world software corpus.
|
| 151 |
+
|
| 152 |
+
For rigorous generalization studies, evaluation on an independent real-world Java vulnerability dataset is recommended.
|
| 153 |
+
|
| 154 |
+
## Limitations
|
| 155 |
+
|
| 156 |
+
This dataset is based on a synthetic benchmark rather than naturally occurring production vulnerabilities.
|
| 157 |
+
|
| 158 |
+
Performance on this dataset should not be interpreted as equivalent to performance on real-world enterprise Java applications.
|
| 159 |
+
|
| 160 |
+
Models trained on this dataset may learn benchmark-specific code patterns.
|
| 161 |
+
|
| 162 |
+
For this reason, results should preferably be reported together with evaluation on additional independent datasets.
|
| 163 |
+
|
| 164 |
+
## License
|
| 165 |
+
|
| 166 |
+
The underlying OWASP Benchmark for Java is distributed under the **GNU General Public License v2.0 (GPL-2.0)**.
|
| 167 |
+
|
| 168 |
+
Users should review the original project's license and terms before redistributing or using derivative datasets.
|
| 169 |
+
|
| 170 |
+
The original project and its license information are available at:
|
| 171 |
+
|
| 172 |
+
https://github.com/OWASP-Benchmark/BenchmarkJava
|
| 173 |
+
|
| 174 |
+
## Attribution
|
| 175 |
+
|
| 176 |
+
This dataset is derived from the OWASP Benchmark Project.
|
| 177 |
+
|
| 178 |
+
OWASP Benchmark Project:
|
| 179 |
+
https://owasp.org/www-project-benchmark/
|
| 180 |
+
|
| 181 |
+
OWASP Benchmark for Java:
|
| 182 |
+
https://github.com/OWASP-Benchmark/BenchmarkJava
|
| 183 |
+
|
| 184 |
+
This repository does not claim ownership of the original OWASP Benchmark source material.
|
| 185 |
+
|
| 186 |
+
## Citation
|
| 187 |
+
|
| 188 |
+
If you use this dataset, please cite the original OWASP Benchmark project in addition to citing this dataset repository.
|
| 189 |
+
|
| 190 |
+
## Disclaimer
|
| 191 |
+
|
| 192 |
+
This dataset is intended for research and security engineering purposes.
|
| 193 |
+
|
| 194 |
+
The presence of a vulnerability label reflects the OWASP Benchmark's intended test classification and does not constitute a security assessment of production software.
|