Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

CVE and CVSS scores explained

After this lesson: I can read a CVSS vector string and work out its base score.

60 min lesson8 commandsVulnerability management lab: Trivy, CVSS, EPSS and KEV

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

Seventy-four problems on one web server

A CVE is the public name of one security flaw, and CVSS is the score that says how severe it is. A scanner that finds 74 problems on a web server reports each one with both.

Nobody fixes 74 things at once. Reading these two names well is the first step to choosing what comes first.

By the end of this lesson

Note

I can read a CVSS vector string and work out its base score.

Key words

WordWhat it meansExample
Vulnerabilitya weakness an attacker could use
CVEa public identifier for one known vulnerabilityCVE-2024-6119
CVSSa standard way to score how severe a vulnerability is
Vector stringthe metric values a CVSS score is worked out fromAV:N/AC:L
Base scorea number from 0 to 10 for the flaw itself
Severitythe band a score falls in, from low to critical

The cells students fill in are left blank in this preview.

Starter

Have a go

Starter

4 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

A CVE names one flaw

A CVE identifier is the year and a number, such as CVE-2024-6119. A CVE Numbering Authority, often the software's own maker, assigns it. The US National Vulnerability Database, NVD, then adds its own analysis.

A scanner such as Trivy reads which packages an image holds and their versions. It compares them with advisories that say which versions each CVE affects and which version fixes it.

Which database is the scanner using?

Command
docker exec scanner trivy --version

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

List the critical findings in the old image

Command
docker exec scanner trivy image --input /targets/web-1.25.3.tar --severity CRITICAL

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

The three critical findings Trivy printed

PackageCVEInstalledFixed in
libexpatCVE-2024-454912.5.0-r12.6.3-r0
libexpatCVE-2024-454922.5.0-r12.6.3-r0
libxml2CVE-2024-561712.11.6-r02.11.8-r1

The cells students fill in are left blank in this preview.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Now ask for high and critical together

Command
docker exec scanner trivy image --input /targets/web-1.25.3.tar --severity HIGH,CRITICAL

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

A vector string says how a flaw works

A CVSS 3.1 vector string holds eight base metrics. Four say how an attack happens: attack vector (AV), attack complexity (AC), privileges required (PR) and user interaction (UI). Scope (S) says whether the attack reaches beyond the vulnerable part.

Three say what is lost: confidentiality (C), integrity (I) and availability (A). Each metric has a weight, and a formula turns them into the base score.

One vector string, read metric by metric

MetricValueIn wordsWeight
AVNFrom anywhere on the network0.85
ACLNo special conditions0.77
PRNNo account needed0.85
UINNobody has to click0.85
SUStays in the vulnerable part-
C, I, AN, N, HOnly availability is lost, fully0, 0, 0.56

The cells students fill in are left blank in this preview.

Try it: a CVSS 3.1 base score

Code: python
AV = {"N": 0.85, "A": 0.62, "L": 0.55, "P": 0.2}
AC = {"L": 0.77, "H": 0.44}
CIA = {"H": 0.56, "L": 0.22, "N": 0}

# Scope unchanged, no privileges and no user action needed.
av, ac = "N", "L"
c, i, a = "N", "N", "H"
pr, ui = 0.85, 0.85

iss = 1 - (1 - CIA[c]) * (1 - CIA[i]) * (1 - CIA[a])
impact = 6.42 * iss
exploitability = 8.22 * AV[av] * AC[ac] * pr * ui
score = min(impact + exploitability, 10)
print("impact", round(impact, 2), "exploitability", round(exploitability, 2))
print("base score, before rounding up", round(score, 3))
# Change ac to "H". The score should become 5.9 once rounded up.

Make a free account to save your work and track your progress.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

One flaw, two scores

NVD scores a flaw for the software in general. A Linux distribution may score it again for its own build, because its settings differ. Trivy keeps every source it knows.

In this snapshot, CVE-2024-45492 scores 9.8 from NVD, reachable over the network. Red Hat scores it 6.2, reachable only locally. Both are base scores, and neither knows your server.

Write the helper that reads reports, part 1

Command
docker exec tools sh -c "printf '%s\n' 'import csv' 'import gzip' 'import json' '' 'EPSS_FILE = \"/work/snapshot/epss-2026-11-20.csv.gz\"' 'KEV_FILE = \"/work/snapshot/kev-2026-11-20.json\"' '' 'def findings(name):' '    with open(\"/work/reports/\" + name + \".json\") as f:' '        report = json.load(f)' '    rows = []' '    for result in report.get(\"Results\", []):' '        rows = rows + (result.get(\"Vulnerabilities\") or [])' '    return rows' '' 'def cve_list(rows):' '    cves = []' '    for v in rows:' '        if v[\"VulnerabilityID\"] not in cves:' '            cves.append(v[\"VulnerabilityID\"])' > steps/snap.py"

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Write the helper that reads reports, part 2

Command
docker exec tools sh -c "printf '%s\n' '    return cves' '' 'def epss(wanted):' '    scores = {}' '    with gzip.open(EPSS_FILE, \"rt\") as f:' '        for row in csv.reader(f):' '            if row[0] in wanted:' '                scores[row[0]] = [float(row[1]), float(row[2])]' '    return scores' '' 'def kev():' '    with open(KEV_FILE) as f:' '        catalogue = json.load(f)' '    return {v[\"cveID\"]: v for v in catalogue[\"vulnerabilities\"]}' '' 'def nvd(v):' '    return v.get(\"CVSS\", {}).get(\"nvd\", {}).get(\"V3Score\")' >> steps/snap.py"

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Save the old image's scan as JSON

Command
docker exec scanner trivy image --input /targets/web-1.25.3.tar --format json -o /work/reports/web.json

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Write the script that compares sources

Command
docker exec tools sh -c "printf '%s\n' 'import snap' '' 'WANTED = [\"CVE-2024-6119\", \"CVE-2024-45492\", \"CVE-2024-56171\"]' 'seen = []' 'for v in snap.findings(\"web\"):' '    cve = v[\"VulnerabilityID\"]' '    if cve in WANTED and cve not in seen:' '        seen.append(cve)' '        print(cve, v[\"PkgName\"], v[\"Severity\"])' '        for source in [\"nvd\", \"redhat\"]:' '            score = v[\"CVSS\"][source]' '            print(\"  \", source, score[\"V3Score\"], score[\"V3Vector\"])' > steps/sources.py"

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Compare NVD and Red Hat scores

Command
docker exec tools python3 steps/sources.py

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

What sources.py printed

CVEPackageNVDRed HatWhat differs
CVE-2024-6119libcrypto37.55.9AC:L against AC:H
CVE-2024-45492libexpat9.86.2AV:N against AV:L, and C and I
CVE-2024-56171libxml29.88.1AV, AC and scope

The cells students fill in are left blank in this preview.

A common mistake

Warning

Many people think a base score of 9.8 means an attack is likely. The base score measures how bad the flaw is if it is used. It says nothing about whether anyone is using it, which lesson 2 measures.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Assignment: a CVSS calculator

Write a CVSS 3.1 base score calculator. WEIGHTS holds the weights of attack vector, attack complexity, user interaction and the three impacts.

parse_vector(text) returns a dictionary of the eight metrics, such as {"AV": "N", ...}. roundup(x) rounds up to one decimal place: multiply by 100000 and round; if that is a whole multiple of 10000 divide it by 100000, otherwise take the next tenth up.

base_score(text) follows the formula. Privileges are 0.85 for N, 0.62 for L and 0.27 for H, or 0.68 and 0.5 when scope is changed. The impact sub-score is 1 minus the product of (1 minus each of C, I and A). Impact is 6.42 times it, or with scope changed 7.52 times (it minus 0.029) minus 3.25 times (it minus 0.02) to the power 15. Exploitability is 8.22 times AV, AC, PR and UI. An impact of 0 or less scores 0. Otherwise round up the smaller of 10 and impact plus exploitability, multiplying the sum by 1.08 first when scope is changed.

Code: python
import math

WEIGHTS = {
    "AV": {"N": 0.85, "A": 0.62, "L": 0.55, "P": 0.2},
    "AC": {"L": 0.77, "H": 0.44},
    "UI": {"N": 0.85, "R": 0.62},
    "CIA": {"H": 0.56, "L": 0.22, "N": 0},
}


def parse_vector(text):
    return {}


def roundup(x):
    return 0


def base_score(text):
    return 0

Make a free account to save your work and track your progress.

Exit quiz

Have a go

Exit quiz

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.