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