@@ -31,7 +31,7 @@
CVE_PRODUCT ??= "${BPN}"
CVE_VERSION ??= "${PV}"
-CVE_CHECK_DB_FILENAME ?= "nvdcve_2-1.db"
+CVE_CHECK_DB_FILENAME ?= "nvdcve_2-2.db"
CVE_CHECK_DB_DIR ?= "${STAGING_DIR}/CVE_CHECK"
CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/${CVE_CHECK_DB_FILENAME}"
CVE_CHECK_DB_FILE_LOCK ?= "${CVE_CHECK_DB_FILE}.lock"
@@ -445,9 +445,10 @@ def get_cve_info(d, cve_data):
cve_data[row[0]]["NVD-summary"] = row[1]
cve_data[row[0]]["NVD-scorev2"] = row[2]
cve_data[row[0]]["NVD-scorev3"] = row[3]
- cve_data[row[0]]["NVD-modified"] = row[4]
- cve_data[row[0]]["NVD-vector"] = row[5]
- cve_data[row[0]]["NVD-vectorString"] = row[6]
+ cve_data[row[0]]["NVD-scorev4"] = row[4]
+ cve_data[row[0]]["NVD-modified"] = row[5]
+ cve_data[row[0]]["NVD-vector"] = row[6]
+ cve_data[row[0]]["NVD-vectorString"] = row[7]
cursor.close()
conn.close()
@@ -534,6 +535,7 @@ def cve_write_data_json(d, cve_data, cve_status):
cve_item["summary"] = cve_data[cve]["NVD-summary"]
cve_item["scorev2"] = cve_data[cve]["NVD-scorev2"]
cve_item["scorev3"] = cve_data[cve]["NVD-scorev3"]
+ cve_item["scorev4"] = cve_data[cve]["NVD-scorev4"]
cve_item["vector"] = cve_data[cve]["NVD-vector"]
cve_item["vectorString"] = cve_data[cve]["NVD-vectorString"]
if 'status' in cve_data[cve]:
@@ -282,6 +282,7 @@ def cve_write_data_json(d, cve_data, cve_status):
cve_item["summary"] = cve_data[cve]["NVD-summary"]
cve_item["scorev2"] = cve_data[cve]["NVD-scorev2"]
cve_item["scorev3"] = cve_data[cve]["NVD-scorev3"]
+ cve_item["scorev4"] = cve_data[cve]["NVD-scorev4"]
cve_item["vector"] = cve_data[cve]["NVD-vector"]
cve_item["vectorString"] = cve_data[cve]["NVD-vectorString"]
if 'status' in cve_data[cve]:
@@ -255,7 +255,7 @@ def initialize_db(conn):
c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \
- SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT, VECTORSTRING TEXT)")
+ SCOREV2 TEXT, SCOREV3 TEXT, SCOREV4 TEXT, MODIFIED INTEGER, VECTOR TEXT, VECTORSTRING TEXT)")
c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \
VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \
@@ -361,12 +361,18 @@ def update_db(conn, elt):
cvssv3 = cvssv3 or elt['cve']['metrics']['cvssMetricV31'][0]['cvssData']['baseScore']
except KeyError:
pass
+ cvssv3 = cvssv3 or 0.0
+ try:
+ accessVector = accessVector or elt['cve']['metrics']['cvssMetricV40'][0]['cvssData']['attackVector']
+ vectorString = vectorString or elt['cve']['metrics']['cvssMetricV40'][0]['cvssData']['vectorString']
+ cvssv4 = elt['cve']['metrics']['cvssMetricV40'][0]['cvssData']['baseScore']
+ except KeyError:
+ cvssv4 = 0.0
accessVector = accessVector or "UNKNOWN"
vectorString = vectorString or "UNKNOWN"
- cvssv3 = cvssv3 or 0.0
- conn.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?, ?)",
- [cveId, cveDesc, cvssv2, cvssv3, date, accessVector, vectorString]).close()
+ conn.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?, ?, ?)",
+ [cveId, cveDesc, cvssv2, cvssv3, cvssv4, date, accessVector, vectorString]).close()
try:
# Remove any pre-existing CVE configuration. Even for partial database
@@ -125,6 +125,8 @@ def process_data(filename, data):
lines += "CVSS v2 BASE SCORE: %s\n" % issue["scorev2"]
if "scorev3" in issue:
lines += "CVSS v3 BASE SCORE: %s\n" % issue["scorev3"]
+ if "scorev4" in issue:
+ lines += "CVSS v4 BASE SCORE: %s\n" % issue["scorev4"]
if "vector" in issue:
lines += "VECTOR: %s\n" % issue["vector"]
if "vectorString" in issue: