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

Free lesson

SBOM-driven vulnerability triage

After this lesson: I can use SBOMs to find which systems hold an affected component.

60 min lesson10 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

Are we affected?

A software bill of materials, an SBOM, is a list of every component inside a piece of software. On the morning a serious flaw is announced, it answers the first question in minutes: which of our systems hold it?

Without one, teams spend days asking every owner to check by hand.

By the end of this lesson

Note

I can use SBOMs to find which systems hold an affected component.

Key words

WordWhat it means
SBOMa list of the components in a piece of software
Componentone package or library, with its version
CycloneDXan open SBOM format from OWASP
Triagedeciding what to deal with first
VEXa statement of whether a product is affected by a CVE

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

An SBOM lists every component

An SBOM names each component with its version and a package URL that says where it came from. Two open formats are common: CycloneDX, from OWASP, and SPDX, from the Linux Foundation.

Trivy writes one with --format cyclonedx. Keep the SBOM of every build, and you can search everything you run without scanning it again.

Write the old image's SBOM

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

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

Write the shop's SBOM

Command
docker exec scanner trivy fs /targets/shop --format cyclonedx -o /work/reports/shop.cdx.json

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

Write the Java service's SBOM

Command
docker exec scanner trivy fs /targets/reports --format cyclonedx -o /work/reports/reports.cdx.json

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

How many components does the image hold?

Command
docker exec tools python3 -c "import json; b = json.load(open('/work/reports/web.cdx.json')); print(b['bomFormat'], b['specVersion'], len(b['components']))"

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

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

Search the SBOMs, not the servers

Imagine the morning Log4Shell was announced. You search every SBOM for log4j and get an answer for every system at once.

An SBOM can also be scanned again later with trivy sbom. A newer database then finds flaws published after the build, with no need for the image or the source.

Try it: which system has a component?

Code: python
bom = {
    "web": [["libssl3", "3.1.4-r5"], ["libexpat", "2.5.0-r1"], ["nginx", "1.25.3-r1"]],
    "reports": [["log4j-core", "2.14.1"], ["jackson-databind", "2.13.2"]],
    "shop": [["Flask", "2.2.2"], ["urllib3", "1.26.12"]],
}

wanted = "log4j-core"
for system in bom:
    for component in bom[system]:
        if component[0] == wanted:
            print(system, "has", component[0], component[1])
# Change wanted to "urllib3". Which system has it now?

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

Write the script that searches SBOMs

Command
docker exec tools sh -c "printf '%s\n' 'import glob' 'import json' 'import sys' '' 'name = sys.argv[1]' 'for path in sorted(glob.glob(\"/work/reports/*.cdx.json\")):' '    with open(path) as f:' '        bom = json.load(f)' '    hits = 0' '    for c in bom.get(\"components\", []):' '        if name in c[\"name\"]:' '            hits = hits + 1' '            print(path.split(\"/\")[-1], c[\"name\"], c.get(\"version\"))' '    if hits == 0:' '        print(path.split(\"/\")[-1], \"nothing called\", name)' > steps/whohas.py"

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

Which SBOMs hold log4j?

Command
docker exec tools python3 steps/whohas.py log4j

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

What whohas.py printed

SBOMComponentVersion
reports.cdx.jsonlog4j-api2.14.1
reports.cdx.jsonlog4j-core2.14.1
shop.cdx.jsonnothing called log4j-
web.cdx.jsonnothing called log4j-

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

Your turn: search for ssl

Command
docker exec tools python3 steps/whohas.py ssl

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

Scan the Java SBOM, not the service

Command
docker exec scanner trivy sbom /work/reports/reports.cdx.json --severity CRITICAL

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

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

VEX records a judgement about one CVE

Not every finding matters. VEX, Vulnerability Exploitability eXchange, lets a supplier or team state that a product is not affected, affected, fixed or still under investigation, with a reason.

Here the team claims curl's CVE-2024-2398, an HTTP/2 client flaw, does not reach nginx, which never calls curl. Trivy then hides those two findings and says why.

Write the team's VEX statement

Command
docker exec tools sh -c "printf '%s\n' '{\"@context\": \"https://openvex.dev/ns/v0.2.0\", \"@id\": \"https://college.example/vex/web-1\",' ' \"author\": \"College IT\", \"timestamp\": \"2026-11-23T09:00:00Z\", \"version\": 1,' ' \"statements\": [{\"vulnerability\": {\"name\": \"CVE-2024-2398\"},' '  \"products\": [{\"@id\": \"pkg:apk/alpine/curl\"}, {\"@id\": \"pkg:apk/alpine/libcurl\"}],' '  \"status\": \"not_affected\", \"justification\": \"vulnerable_code_not_in_execute_path\"}]}' > /work/web.vex.json"

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

Scan again with the VEX statement

Command
docker exec scanner trivy image --input /targets/web-1.25.3.tar --vex /work/web.vex.json --show-suppressed

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

A common mistake

Warning

Many people think a VEX statement removes the flaw. The package is still installed; the statement only records why it does not matter now. It needs evidence and a review date, because a later change could make it wrong.

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: who is affected?

Answer "are we affected?" from SBOMs. boms is a dictionary from a system's name to its SBOM, a dictionary whose components list holds dictionaries with name and version.

version_parts(text) turns "2.14.1" into [2, 14, 1]. is_older(version, fixed) is True when the version is below the fixed one, comparing numbers, not text. affected_systems(boms, name, fixed) returns, in the order of boms, the systems holding that component at a version older than the fixed one.

Code: python
def version_parts(text):
    return []


def is_older(version, fixed):
    return False


def affected_systems(boms, name, fixed):
    return []

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.