Datasets:
Guanni Qu
commited on
Commit
·
c83ccbe
1
Parent(s):
32fc41c
Update dataset card with proper YAML frontmatter
Browse files
README.md
CHANGED
|
@@ -1,126 +1,168 @@
|
|
| 1 |
-
# A minimal formal model for LLM tool permissions + a tiny detector for prompt-injection-induced grants
|
| 2 |
-
|
| 3 |
-
**TL;DR.** LLM agents call tools. Prompt injection can coerce the agent into **granting new rights** (e.g., `browser.read`) it wasn’t authorized to have — a classic **grant/take/transfer** abuse. I wrote a tiny, opinionated core + detector that flags **unauthorized grants** and (optionally) **blocks** them with a deny-by-default policy. Minimal moving parts, fast to reason about, easy to extend.
|
| 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 |
-
## Quickstart
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
-
python3 simulate.py cases/injected.json
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
|
| 76 |
|
| 77 |
-
|
| 78 |
-
`No unauthorized grants detected.`
|
| 79 |
-
- Injected:
|
| 80 |
-
`UNAUTHORIZED GRANT DETECTED: assistant -> browser.read reason='...'`
|
| 81 |
-
- Injected + Autofix:
|
| 82 |
-
`[DETECTOR] UNAUTHORIZED GRANT DETECTED: ...`
|
| 83 |
-
`[AUTOFIX] Blocked unauthorized grant.`
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
|
| 88 |
|
| 89 |
-
|
|
|
|
| 90 |
|
| 91 |
-
|
| 92 |
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
```
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
---
|
| 102 |
-
|
| 103 |
-
## Tiny benchmark plan (what I’m targeting)
|
| 104 |
-
|
| 105 |
-
- **40 prompts** total (20 benign / 20 injected)
|
| 106 |
-
- KPI goal by **Nov 6**: **precision ≥ 0.80**, **recall ≥ 0.70** on unauthorized grants
|
| 107 |
-
- For the demo here, I show the 3 canonical cases above
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
## Roadmap (2 weeks)
|
| 112 |
-
|
| 113 |
-
- **v0.1**: formal core + detector + 40-prompt micro-benchmark; **min-fix playbook**; **5-page draft** + tidy repo
|
| 114 |
-
- **Stretch**: add `transfer` events; a simple lattice for right inclusion; evaluate on a more diverse injection set; logs → JSONL for downstream dashboards
|
| 115 |
-
|
| 116 |
-
---
|
| 117 |
-
|
| 118 |
-
## Impact (why this framing)
|
| 119 |
|
| 120 |
-
|
| 121 |
-
- Makes agent tool-use **observable** and **enforceable**.
|
| 122 |
-
- Plays nicely with stronger detectors/policies later; baseline is intentionally small so it’s easy to reason about and extend.
|
| 123 |
-
|
| 124 |
-
---
|
| 125 |
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-classification
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- linux-kernel
|
| 9 |
+
- security
|
| 10 |
+
- vulnerabilities
|
| 11 |
+
- code
|
| 12 |
+
- bugs
|
| 13 |
+
- software-engineering
|
| 14 |
+
pretty_name: Linux Kernel Vulnerability Dataset
|
| 15 |
+
size_categories:
|
| 16 |
+
- 100K<n<1M
|
| 17 |
---
|
| 18 |
|
| 19 |
+
# Linux Kernel Vulnerability Dataset
|
| 20 |
+
|
| 21 |
+
**125,183 bug-introducing commits** mined from 20 years of Linux kernel git history (2005-2025).
|
| 22 |
+
|
| 23 |
+
## Dataset Description
|
| 24 |
+
|
| 25 |
+
This dataset maps every kernel bug fix with a `Fixes:` tag back to the commit that introduced the bug. It enables research on:
|
| 26 |
+
|
| 27 |
+
- **Vulnerability detection**: Train models to identify bug-introducing commits
|
| 28 |
+
- **Bug lifetime analysis**: Study how long different bug types persist
|
| 29 |
+
- **Subsystem risk assessment**: Identify which kernel subsystems have the longest-lived bugs
|
| 30 |
+
- **Developer patterns**: Analyze who introduces and fixes bugs
|
| 31 |
+
|
| 32 |
+
### Key Statistics
|
| 33 |
+
|
| 34 |
+
| Metric | Value |
|
| 35 |
+
|--------|-------|
|
| 36 |
+
| Total bug-fix pairs | 125,183 |
|
| 37 |
+
| Valid records (0 < lifetime < 27 years) | 123,696 |
|
| 38 |
+
| Average bug lifetime | 2.1 years |
|
| 39 |
+
| Median bug lifetime | 0.7 years |
|
| 40 |
+
| Longest-lived bug | 20.7 years |
|
| 41 |
+
| Bugs hiding 5+ years | 13.5% |
|
| 42 |
+
| Unique fixing commits | 119,449 |
|
| 43 |
+
| Unique bug-introducing authors | 9,159 |
|
| 44 |
+
| With CVE ID | 158 |
|
| 45 |
+
| With Cc: stable | 27,875 (22%) |
|
| 46 |
+
|
| 47 |
+
## Dataset Structure
|
| 48 |
+
|
| 49 |
+
### Data Fields
|
| 50 |
+
|
| 51 |
+
| Column | Type | Description |
|
| 52 |
+
|--------|------|-------------|
|
| 53 |
+
| `fixing_commit` | string | SHA of the commit that fixed the bug |
|
| 54 |
+
| `introducing_commit` | string | SHA of the commit that introduced the bug |
|
| 55 |
+
| `lifetime_days` | int | Days between introduction and fix |
|
| 56 |
+
| `subsystem` | string | Kernel subsystem (networking, drivers, fs, etc.) |
|
| 57 |
+
| `bug_type` | string | Detected bug type (race-condition, null-deref, etc.) |
|
| 58 |
+
| `fix_subject` | string | Commit message subject of the fix |
|
| 59 |
+
| `fixing_date` | datetime | When the fix was committed |
|
| 60 |
+
| `introducing_date` | datetime | When the bug was introduced |
|
| 61 |
+
| `files_changed` | string | Files modified in introducing commit |
|
| 62 |
+
| `insertions` | int | Lines added in introducing commit |
|
| 63 |
+
| `deletions` | int | Lines removed in introducing commit |
|
| 64 |
+
| `cve_id` | string | CVE ID if mentioned in fix commit (nullable) |
|
| 65 |
+
| `cc_stable` | bool | Whether fix was tagged for stable backport |
|
| 66 |
+
| `fix_author` | string | Author of the fix |
|
| 67 |
+
| `intro_author` | string | Author who introduced the bug |
|
| 68 |
+
|
| 69 |
+
### Subsystem Distribution
|
| 70 |
+
|
| 71 |
+
| Subsystem | Count | Avg Lifetime |
|
| 72 |
+
|-----------|-------|--------------|
|
| 73 |
+
| drivers | 38,412 | 2.3 years |
|
| 74 |
+
| networking | 6,079 | 2.9 years |
|
| 75 |
+
| gpu | 5,212 | 1.4 years |
|
| 76 |
+
| filesystem | 4,891 | 2.6 years |
|
| 77 |
+
| sound | 3,847 | 2.1 years |
|
| 78 |
+
| usb | 2,505 | 3.5 years |
|
| 79 |
+
| memory | 2,459 | 1.8 years |
|
| 80 |
+
| bpf | 959 | 1.1 years |
|
| 81 |
+
|
| 82 |
+
### Bug Type Distribution
|
| 83 |
+
|
| 84 |
+
| Bug Type | Count | Avg Lifetime |
|
| 85 |
+
|----------|-------|--------------|
|
| 86 |
+
| null-deref | 4,931 | 2.2 years |
|
| 87 |
+
| use-after-free | 2,963 | 3.2 years |
|
| 88 |
+
| memory-leak | 2,846 | 3.1 years |
|
| 89 |
+
| refcount | 2,209 | 2.8 years |
|
| 90 |
+
| deadlock | 1,683 | 2.2 years |
|
| 91 |
+
| race-condition | 1,188 | 5.1 years |
|
| 92 |
+
| buffer-overflow | 399 | 3.1 years |
|
| 93 |
+
| integer-overflow | 298 | 3.9 years |
|
| 94 |
+
|
| 95 |
+
## Collection Methodology
|
| 96 |
+
|
| 97 |
+
### Mining Process
|
| 98 |
+
|
| 99 |
+
1. Clone Linux kernel repository at v6.19-rc3
|
| 100 |
+
2. Run `git log --grep="Fixes:"` to find all fixing commits
|
| 101 |
+
3. Extract the referenced commit hash from each `Fixes:` tag using regex
|
| 102 |
+
4. Retrieve metadata (dates, authors, files) from both commits
|
| 103 |
+
5. Classify subsystem from file paths using 70+ regex patterns
|
| 104 |
+
6. Detect bug type from commit message keywords
|
| 105 |
+
7. Calculate lifetime as `fixing_date - introducing_date`
|
| 106 |
+
|
| 107 |
+
### Extraction Code
|
| 108 |
+
|
| 109 |
+
```python
|
| 110 |
+
import re
|
| 111 |
+
|
| 112 |
+
def extract_fixes_tag(commit_msg: str) -> str | None:
|
| 113 |
+
"""Extract the commit ID from a Fixes: tag"""
|
| 114 |
+
pattern = r'Fixes:\s*([a-f0-9]{12,40})'
|
| 115 |
+
match = re.search(pattern, commit_msg, re.IGNORECASE)
|
| 116 |
+
return match.group(1) if match else None
|
| 117 |
```
|
| 118 |
|
| 119 |
+
### Filtering
|
|
|
|
|
|
|
| 120 |
|
| 121 |
+
- Excluded commits where `Fixes:` tag points to non-existent hash
|
| 122 |
+
- Excluded merge commits
|
| 123 |
+
- For lifetime analysis: excluded same-day fixes (lifetime_days = 0)
|
| 124 |
+
- For lifetime analysis: excluded outliers (lifetime > 10,000 days)
|
| 125 |
|
| 126 |
+
## Limitations
|
|
|
|
| 127 |
|
| 128 |
+
- **Selection bias**: Only ~28% of fix commits use `Fixes:` tags. Well-documented bugs (likely more serious) are overrepresented.
|
| 129 |
+
- **Mainline only**: Doesn't include bugs fixed only in stable branches or vendor kernels.
|
| 130 |
+
- **Subsystem classification**: Heuristic-based on file paths; some bugs span multiple subsystems.
|
| 131 |
+
- **Bug type detection**: Keyword-based; many bugs classified as "unknown".
|
| 132 |
+
- **Timestamp accuracy**: Uses author dates, not commit dates. Rebasing can skew.
|
| 133 |
|
| 134 |
+
## Intended Uses
|
| 135 |
|
| 136 |
+
### Recommended
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
+
- Training vulnerability detection models (e.g., VulnBERT)
|
| 139 |
+
- Analyzing bug lifetime patterns across subsystems
|
| 140 |
+
- Studying the evolution of kernel security over time
|
| 141 |
+
- Research on code review and testing effectiveness
|
| 142 |
|
| 143 |
+
### Out of Scope
|
| 144 |
|
| 145 |
+
- Direct exploit development (commits don't include full code context)
|
| 146 |
+
- Claiming completeness of kernel vulnerability data
|
| 147 |
|
| 148 |
+
## Citation
|
| 149 |
|
| 150 |
+
```bibtex
|
| 151 |
+
@dataset{qu2026kernelvuln,
|
| 152 |
+
author = {Qu, Jenny Guanni},
|
| 153 |
+
title = {Linux Kernel Vulnerability Dataset},
|
| 154 |
+
year = {2026},
|
| 155 |
+
publisher = {HuggingFace},
|
| 156 |
+
url = {https://huggingface.co/datasets/quguanni/kernel-vuln-dataset}
|
| 157 |
+
}
|
| 158 |
```
|
| 159 |
|
| 160 |
+
## License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
+
MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
+
## Contact
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
+
- **Author**: Jenny Guanni Qu
|
| 167 |
+
- **Email**: jenny@pebblebed.com
|
| 168 |
+
- **Blog post**: [Kernel bugs hide for 2 years on average](https://pebblebed.com/blog/kernel-bugs)
|