File size: 5,207 Bytes
2cd65d1 06a9bbf 2cd65d1 1254d3f 2cd65d1 2806cdc 2cd65d1 2806cdc 2cd65d1 2806cdc 2cd65d1 2806cdc 2cd65d1 7e54eb7 2cd65d1 7e54eb7 2806cdc 2cd65d1 2806cdc 2cd65d1 |
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 |
---
viewer: false
license: mit
language:
- en
tags:
- vulnerabilities
- vdb
- sca
- osv
- nvd
- ghsa
- vers
- purl
---
This dataset comprises application and OS vulnerabilities aggregated from multiple sources, including OSV, GitHub, NVD, and Linux vendor feeds, in the form of SQLite data files (.vdb6).
## Vulnerability Data sources
- Linux [vuln-list](https://github.com/appthreat/vuln-list)
- OSV (1)
- NVD
- GitHub
## Linux distros
- AlmaLinux
- Debian
- Alpine
- Amazon Linux
- Arch Linux
- RHEL/CentOS
- Rocky Linux
- Ubuntu
- OpenSUSE
- Photon
- Chainguard
- Wolfi OS
## Database files
The vulnerability database comprises two SQLite database files.
- data.index.vdb6 - A smaller index database optimized for quick purl or cpe string searches and vers-based range comparisons.
- data.vdb6 - Full CVE source database containing normalized data in CVE 5.1 specification formation and purl prefix.
### cve_index schema
```sql
CREATE TABLE if not exists cve_index(
cve_id TEXT NOT NULL,
type TEXT NOT NULL,
namespace TEXT,
name TEXT NOT NULL,
vers TEXT NOT NULL,
purl_prefix TEXT NOT NULL
)
```
### cve_data schema
```sql
CREATE TABLE if not exists cve_data(
cve_id TEXT NOT NULL,
type TEXT NOT NULL,
namespace TEXT,
name TEXT NOT NULL,
source_data BLOB NOT NULL,
override_data BLOB,
source_data_hash TEXT NOT NULL,
vers TEXT NOT NULL,
purl_prefix TEXT NOT NULL
)
```
## Folders
- app - Application vulnerabilities from 2018. Useful for secure code reviews.
- app-2y - Application vulnerabilities from 2024. Useful to check for the latest vulnerabilities quickly.
- app-10y - Application vulnerabilities from 2014.
- app-os - Application and OS vulnerabilities from 2018. Useful for lifecycle analysis and container SBOM scans.
- app-os-10y - Application and OS vulnerabilities from 2014.
Download data.vdb6 and data.index.vdb6 files from a single folder of your choice.
## Searching for CVEs
Use the smaller index database for all search operations.
### Searching by purl
Given a purl string (`purl_str`), perform the following steps to convert this into a suitable purl prefix (`purl_prefix`) string:
In most cases, a purl prefix is a substring at index 0 after a split by "@". Eg: `purl_prefix = purl_str.split("@")[0]`.
A more robust approach:
- Parse and validate the string using a suitable [library](https://github.com/package-url/). Retain the parsed purl object (`purl_obj`)
- Construct a purl prefix string with the following logic:
- Set the value for `purl_prefix` to `"pkg:" + purl_obj["type"]`
- If there is a namespace, append it to purl_prefix after the slash character. Eg: `purl_prefix = purl_prefix + "/" + purl_obj['namespace']`
- Optional for Linux distros: If there is a qualifier string with the name `distro_name`, append it to the purl_prefix after the slash character. Eg: `purl_prefix = purl_prefix + "/" + purl_obj['qualifiers']['distro_name']`
- Append the name after the slash character. Eg: `purl_prefix = purl_prefix + "/" + purl_obj['name']`
Use the below SQL query to search by purl_prefix:
```
SELECT DISTINCT cve_id, type, namespace, name, vers, purl_prefix FROM cve_index where purl_prefix = ?;
```
### Searching by cpe
Parse the cpe string to extract the vendor, product, and version. The regex for python is shown below:
```python
import re
CPE_FULL_REGEX = re.compile(
"cpe:?:[^:]+:(?P<cve_type>[^:]+):(?P<vendor>[^:]+):(?P<package>[^:]+):(?P<version>[^:]+):(?P<update>[^:]+):(?P<edition>[^:]+):(?P<lang>[^:]+):(?P<sw_edition>[^:]+):(?P<target_sw>[^:]+):(?P<target_hw>[^:]+):(?P<other>[^:]+)"
)
```
In the `cve_index` table, vendor maps to namespace and package maps to name. The SQL query is below:
```sql
SELECT DISTINCT cve_id, type, namespace, name, vers, purl_prefix FROM cve_index where namespace = ? AND name = ?;
```
### Comparing version ranges using vers
Refer to the vers [documentation](https://github.com/package-url/purl-spec/blob/version-range-spec/VERSION-RANGE-SPEC.rst) for information regarding vers and a logic to parse and check if a version is within a range. To simplify the logic, a value from the vers column in `cve_index` would contain only a maximum of two constraints (one greater than and one lesser than).
## Combining data
Search the `cve_index` table in the index database first to retrieve any matching cve_id and purl_prefix values. Use these two column values to retrieve the full CVE source information from the `cve_data` table. An example query is shown below:
```sql
SELECT DISTINCT cve_id, type, namespace, name, source_data_hash, json(source_data), json(override_data), vers, purl_prefix FROM cve_data
WHERE cve_id = ? AND vers = ? AND purl_prefix = ?
GROUP BY purl_prefix
ORDER BY cve_id DESC;
```
Use the `source_data_hash` values to filter out any duplicate results for the same CVE. Duplicate results are possible when multiple vers match the same CVE and purl prefixes.
## Citation
Use the below citation in your research.
```text
@misc{vdb,
author = {Team AppThreat},
month = May,
title = {{AppThreat vulnerability-db}},
howpublished = {{https://huggingface.co/datasets/AppThreat/vdb}},
year = {2025}
}
```
|