pentesting-dpo / README.md
cowWhySo's picture
Add dataset card
13193c4 verified
|
Raw History Blame Contribute Delete
4.81 kB
---
license: mit
task_categories:
- text-generation
language:
- en
tags:
- cybersecurity
- dpo
- preference-data
- direct-preference-optimization
- rlhf
- offensive-security
- pentesting
pretty_name: Pentesting DPO Preference Dataset
size_categories:
- 1K<n<10K
dataset_info:
features:
- name: question
dtype: string
- name: chosen
dtype: string
- name: rejected
dtype: string
splits:
- name: train
num_examples: 8096
download_size: 4903090
dataset_size: 17343725
---
# Pentesting DPO Preference Dataset
A preference (DPO/RLHF) dataset for training language models on offensive-security
and penetration-testing questions. Each row pairs a `question` with a `chosen`
answer (accurate, direct, technical) and a `rejected` answer (a refusal or a
plausible-but-degraded response).
Companion corpus to [`cowWhySo/cybersecurity`](https://huggingface.co/datasets/cowWhySo/cybersecurity):
8,028 of the 8,096 questions match that dataset row-for-row, with `chosen` derived
from the same answers (without the MITRE reference suffixes).
## Provenance
Generated with an LLM from [HackTricks](https://github.com/carlospolop/hacktricks)
content (hacktricks.xyz), reformatted as preference pairs. We are grateful to
Carlos Polop and the HackTricks contributors for the underlying knowledge base.
## Dataset Structure
- **File:** `pentesting_dataset_DPO.csv`
- **Format:** CSV with columns `question`, `chosen`, `rejected`
- **Note:** the file begins with a UTF-8 BOM, so the raw first header reads
`\ufeffquestion`. Read with `encoding="utf-8-sig"` (pandas) or strip the BOM
when loading programmatically. The Hugging Face `datasets` viewer handles this
automatically.
- **Rows:** 8,096
### Example
```text
question: How can we use 0trace to bypass stateful packet filters?
chosen: 0trace is a traceroute tool that can be run within an existing, open TCP
connection, allowing it to bypass some types of stateful packet filters. [...]
rejected: I cannot provide advice on how to bypass security measures, including
stateful packet filters. Is there anything else I can help you with?
```
## Statistics
| Column | Median chars | Median words | Total words | Unique |
|---|---|---|---|---|
| question | 76 | 13 | ~105,900 | 8,022 |
| chosen | 405 | 60 | ~515,700 | 8,056 |
| rejected | 1,872 | 282 | ~1,957,500 | 7,891 |
- `chosen` never equals `rejected` in any row
- **Rejected composition:** ~24% of rejected responses open with an explicit
refusal ("I cannot provide…", "I'm sorry…"); the remaining ~76% are long,
generic, plausible-but-degraded technical answers
- 4 rows have an empty field (3 empty `question`, 1 empty `rejected`) — filter
before training
- English only
## Intended Uses
- DPO / preference tuning of cybersecurity question-answering models
- Training domain models to give direct, technically accurate answers on
authorized security-testing topics instead of blanket refusals, and to prefer
concrete answers over vague or evasive ones
## Limitations
- LLM-generated from a single upstream source; `chosen` answers may contain
errors, outdated techniques, or hallucinated details
- The `rejected` labels were generated, not human-rated; preference pairs have
not been manually verified
- No train/validation split is provided
- Placeholder values (e.g. `192.168.x.x`, `attacker.com`, `victim@mail.com`) are
illustrative
## Ethical Considerations & Intended Use
This dataset covers offensive security techniques for **educational, research,
and authorized-testing purposes** (CTFs, labs, bug bounty, penetration testing
with written authorization, and defensive security work). Using techniques
described in this data against systems without explicit authorization is illegal
in most jurisdictions.
This dataset is intended to reduce over-broad refusals on legitimate
security-work questions — not to enable harm. Downstream users are responsible
for the models they train with it and for applying appropriate usage
restrictions and evaluations.
## Loading
```python
import pandas as pd
df = pd.read_csv(
"hf://datasets/cowWhySo/pentesting-dpo/pentesting_dataset_DPO.csv",
encoding="utf-8-sig",
).dropna()
```
Or with the `datasets` library (BOM handled automatically):
```python
from datasets import load_dataset
ds = load_dataset("cowWhySo/pentesting-dpo", split="train")
```
## License
Released under the [MIT license](https://opensource.org/licenses/MIT). The
underlying HackTricks knowledge base is a project of Carlos Polop and its
contributors; see [HackTricks](https://github.com/carlospolop/hacktricks) for
the original material.