Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 3 of 6 · Lab · 25 min · revision 3

Lab: SBOMs and a vulnerability triage policy

Generate a CycloneDX Software Bill of Materials (SBOM) for an image with Syft, see how SPDX differs, gate the SBOM with Trivy, and use an OpenVEX statement to document a false positive that blocks a release, with evidence, instead of hiding it.

Contentsand lesson path

What you will learn

  • Generate an SBOM for an image, scan dependencies and images for known vulnerabilities, and apply a triage policy that weighs severity, exploitability and reachability.

01. Software Bill of Materials (SBOM): CycloneDX and SPDX Standards

When a critical zero-day vulnerability (such as Log4Shell or OpenSSL memory corruption) is disclosed, the most pressing operational challenge for SRE and security teams is one question: "Are we running this vulnerable package anywhere in our production estate?" In legacy environments lacking component visibility, answering this question requires launching emergency audits across hundreds of repositories, re-scanning gigabytes of container images, or inspecting running server filesystems.

A Software Bill of Materials (SBOM) is a machine-readable inventory of the components that a generator finds inside an application artifact: libraries, transitive dependencies, OS packages and, where it can tell, their licenses. Anything the generator cannot detect (a vendored file copied in by hand, a binary built without module information) is missing from it. Crucially, an SBOM is an inventory of ingredients, distinct from a point-in-time vulnerability scan report. By decoupling component identification from vulnerability matching, security teams can match a newly published CVE advisory against the SBOMs they already store and find the affected services without rebuilding or rescanning images.

Modern SBOM generators like Syft parse package lockfiles (package-lock.json, go.mod, Cargo.lock, requirements.txt) and container layer tarballs, extracting exact Package URLs (purls) defined by the standardized PURL specification (pkg:golang/golang.org/x/[email protected]). Purls remove most naming ambiguity across ecosystems (the same name in npm and PyPI gets a different purl), enabling automated vulnerability correlation engines to cross-reference entries against the National Vulnerability Database (NVD), GitHub Advisory Database, and Open Source Vulnerabilities (OSV) database.

Two open SBOM formats dominate:

  • CycloneDX (OWASP Standard): Specifically engineered for modern application security, software supply chain analysis, and automated dependency graph processing. It supports rich component types (libraries, frameworks, operating systems, containers), external references, cryptographic hashes, and native integration with Vulnerability Exploitability eXchange (VEX) declarations.

  • SPDX (Software Package Data Exchange - ISO/IEC 5962): An international open standard originally created for open-source software license compliance, later expanded to cover security provenance and software component relationships.

JSON · sbom.cdx.json from Syft 1.57 (abridged; still valid JSON)
{
  "bomFormat": "CycloneDX",
  "specVersion": "1.7",
  "serialNumber": "urn:uuid:3980dce3-7702-453e-af2a-4da41a4ce7e6",
  "version": 1,
  "metadata": {
    "component": {
      "type": "container",
      "name": "payment-service",
      "version": "sha256:6baa7c7ee741dd2e76d022c80854a3ba..."
    }
  },
  "components": [
    {
      "type": "library",
      "name": "golang.org/x/crypto",
      "version": "v0.18.0",
      "purl": "pkg:golang/golang.org/x/[email protected]",
      "properties": [
        { "name": "syft:location:0:path", "value": "/app/payment-service" }
      ]
    }
  ]
}

02. Contextual Vulnerability Triage: Moving Beyond Raw CVSS Scores

A naive security policy mandates that any container image exhibiting a "Critical" or "High" Common Vulnerability Scoring System (CVSS) score must automatically fail CI/CD build gates. In practice this causes alert fatigue and stalled deployments. Security scanners frequently flag vulnerabilities in base OS packages (such as a flaw in an unused Linux command-line compression utility or a font-rendering library) that are never executed by the application runtime.

Contextual triage adds three signals:

  • 1. CVSS vs. Exploitability (EPSS): The Exploit Prediction Scoring System (EPSS) models the statistical probability that a software vulnerability will be weaponized in the wild within thirty days. EPSS is a probability, not a confirmation: a CVSS 9.8 flaw with an EPSS score of 0.001 is usually a lower priority than a CVSS 7.5 flaw with an EPSS score of 0.9. Confirmed exploitation is what the KEV catalogue below records.

  • 2. CISA Known Exploited Vulnerabilities (KEV) Catalog: Maintained by the US Cybersecurity and Infrastructure Security Agency. Every entry in the catalogue has evidence of exploitation in the wild, a required action and a due date by which US federal agencies must act. For other organisations it is a strong priority signal: a KEV entry usually goes ahead of a higher-CVSS flaw that nobody is known to exploit.

  • 3. Vulnerability Exploitability eXchange (VEX): When a scanner flags an unpatchable or unexploitable flaw (e.g. vulnerable code is unreachable, or mitigated by runtime seccomp profiles), engineering teams author a machine-readable VEX statement using the OpenVEX standard. Rather than permanently disabling scanner rules, VEX records a structured claim (e.g. status: not_affected, justification: vulnerable_code_not_in_execute_path) about one vulnerability in one product, identified by its exact package URL, so scanners suppress only that finding. OpenVEX has no review-date field; track the next review in your ticket. A VEX statement is a claim you are accountable for: the justification must match the evidence (vulnerable_code_not_present means the vulnerable code is not in the product at all; inline_mitigations_already_exist means it is present but mitigated), and you re-check it whenever the code or the dependency changes. Some CVEs do not belong in an image VEX at all: CVE-2024-21626 ("Leaky Vessels") is a container escape in runc, the host's container runtime, and is fixed by upgrading runc on the nodes to 1.1.12 or later, not by a statement about your image.

Furthermore, high-maturity teams integrate runtime reachability analysis. Using static call-graph analyzers or eBPF kernel tracing agents in staging environments, systems verify whether the vulnerable functions (such as an unauthenticated XML parsing method) are ever loaded into active process memory, providing evidence to support OpenVEX not-affected statements; record that evidence in the impact statement or the linked ticket.

JSON · openvex.json: one not_affected statement, backed by govulncheck evidence
{
  "@context": "https://openvex.dev/ns/v0.2.0",
  "@id": "https://example.com/vex/payment-service-2026-10-30-01",
  "author": "Payments security team <[email protected]>",
  "timestamp": "2026-10-30T12:00:00Z",
  "version": 1,
  "statements": [
    {
      "vulnerability": { "name": "CVE-2024-45337" },
      "products": [
        {
          "@id": "pkg:golang/example.com/payment-service",
          "subcomponents": [{ "@id": "pkg:golang/golang.org/x/[email protected]" }]
        }
      ],
      "status": "not_affected",
      "justification": "vulnerable_code_not_in_execute_path",
      "impact_statement": "Only x/crypto/bcrypt is used; govulncheck: no path to ssh"
    }
  ]
}

03. Lab Execution: Syft SBOM Generation, Trivy Scan, and VEX Triage

You will build a small Go service into an image, generate an SBOM of the image with Syft, gate it with Trivy, write one evidence-backed VEX statement, test that a wrong VEX is ignored, and finally fix the findings the right way: by upgrading.

What you need: Go 1.26 or later, Docker, jq, Syft 1.x and Trivy (the outputs below came from Go 1.27.4, Syft 1.57.2 and Trivy 0.76.2 with its vulnerability database of 17 November 2026; your counts will differ as new CVEs are published). The service deliberately pins golang.org/x/crypto v0.18.0 but only uses its bcrypt package.

  1. Create the service.
Bash · Step 1: module with an old dependency
mkdir payment-service && cd payment-service
go mod init example.com/payment-service
# save main.go (below) first, then pin the old x/crypto on purpose
go get golang.org/x/[email protected] && go mod tidy
Go · main.go
// payment-service: a tiny HTTP service that hashes PINs with bcrypt.
// It depends on golang.org/x/crypto but never imports x/crypto/ssh.
package main

import (
	"fmt"
	"log"
	"net/http"

	"golang.org/x/crypto/bcrypt"
)

func main() {
	http.HandleFunc("/hash", func(w http.ResponseWriter, r *http.Request) {
		h, err := bcrypt.GenerateFromPassword([]byte(r.URL.Query().Get("pin")), 10)
		if err != nil {
			http.Error(w, err.Error(), http.StatusBadRequest)
			return
		}
		fmt.Fprintln(w, string(h))
	})
	log.Fatal(http.ListenAndServe(":8080", nil))
}
Dockerfile · Dockerfile (static binary on an empty base image)
FROM golang:1.27 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
RUN CGO_ENABLED=0 go build -trimpath -o /out/payment-service .

FROM scratch
COPY --from=build /out/payment-service /app/payment-service
ENTRYPOINT ["/app/payment-service"]
  1. Build the image and generate its SBOM. Syft reads the module list that Go embeds in the binary, so the SBOM describes what actually shipped, not just what go.mod declares. (syft packages is the older alias of syft scan.)
Bash · Step 2: image and CycloneDX SBOM
docker build -t payment-service:2.4.0 .
syft scan docker:payment-service:2.4.0 -o cyclonedx-json=sbom.cdx.json
syft scan docker:payment-service:2.4.0 -q -o table
Expected output (the stdlib line shows your Go version)
NAME                         VERSION   TYPE
example.com/payment-service  UNKNOWN   go-module
golang.org/x/crypto          v0.18.0   go-module
stdlib                       go1.27.4  go-module
  1. Gate on the SBOM. trivy sbom exits 0 whatever it finds unless you pass --exit-code 1, so a gate without that flag proves nothing. The first command counts HIGH and CRITICAL findings and shows the position of CVE-2024-45337 in the list; the second is the gate.
Bash · Step 3: count findings, then run the gate
Q='[.Results[]?.Vulnerabilities[]?.VulnerabilityID]
   | (length, index("CVE-2024-45337"))'
trivy sbom sbom.cdx.json --severity HIGH,CRITICAL --format json --quiet | jq "$Q"
trivy sbom sbom.cdx.json --severity HIGH,CRITICAL --exit-code 1 --quiet >/dev/null
echo "gate exit: $?"
Illustrative output (vulnerability DB of 17 November 2026; counts change as new CVEs are published)
13
0
gate exit: 1
  1. Collect evidence before you write a VEX statement. CVE-2024-45337 (Go ID GO-2024-3321) is in golang.org/x/crypto/ssh. govulncheck analyses the call graph and reports whether your code can reach the vulnerable symbols.
Bash · Step 4: reachability with govulncheck
go run golang.org/x/vuln/cmd/[email protected] ./...
go run golang.org/x/vuln/cmd/[email protected] -show verbose ./... \
  | grep -A6 GO-2024-3321
Illustrative output (abridged; Go vulnerability database of 17 November 2026, so the counts and the number of GO-2024-3321 in the list change over time)
Your code is affected by 0 vulnerabilities.
This scan also found 0 vulnerabilities in packages you import and 22
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
...
Vulnerability #22: GO-2024-3321
    Misuse of connection.serverAuthenticate may cause authorization bypass in
    golang.org/x/crypto
  More info: https://pkg.go.dev/vuln/GO-2024-3321
  Module: golang.org/x/crypto
    Found in: golang.org/x/[email protected]
    Fixed in: golang.org/x/[email protected]
  1. Write the VEX statement and apply it. Save the OpenVEX document from the previous section as openvex.json. Its product is the application that ships the library, pkg:golang/example.com/payment-service from the SBOM, and the library is listed as a subcomponent. Scope matters: a statement whose product is the library itself (pkg:golang/golang.org/x/[email protected]) claims that x/crypto is not affected anywhere, and if the file is shared it would silence the CVE for services that do call x/crypto/ssh. For trivy image scans the product can be the image itself (pkg:oci/...). The suppressed CVE disappears from the list (index returns null), but the count drops by only one and the gate still fails: the other findings are real and have no VEX statement.
Bash · Step 5: apply the VEX document
trivy sbom sbom.cdx.json --vex openvex.json --severity HIGH,CRITICAL \
  --format json --quiet | jq "$Q"
Illustrative output (Trivy 0.76.2, vulnerability DB of 17 November 2026: one finding fewer than in step 3)
12
null
  1. Negative test: a VEX statement for the wrong version is ignored. The subcomponent purl must match exactly, version included, which is what you want: a statement about x/crypto v0.19.0 must not silence v0.18.0. The product purl has no version, so it matches every version of payment-service; add a version if a statement should cover only one release. Trivy matches a product with subcomponents only when the SBOM records which package depends on the library; Syft's SBOM does, which is why the statement in step 5 worked.
Bash · Step 6: mismatched subcomponent version
sed 's/[email protected]/[email protected]/' openvex.json > wrong-vex.json
trivy sbom sbom.cdx.json --vex wrong-vex.json --severity HIGH,CRITICAL \
  --format json --quiet | jq "$Q"
Illustrative output (Trivy 0.76.2, vulnerability DB of 17 November 2026: the same count as in step 3)
13
0
  1. Fix it properly. VEX is for specific, justified exceptions, not for a list of unrelated CVEs. Upgrading the dependency removed all of them, and the gate passed with the DB of the run below; a later CVE in the new version would fail it again.
Bash · Step 7: upgrade, rebuild, rescan
go get golang.org/x/crypto@latest && go mod tidy
docker build -t payment-service:2.4.1 .
syft scan docker:payment-service:2.4.1 -o cyclonedx-json=sbom.cdx.json
trivy sbom sbom.cdx.json --severity HIGH,CRITICAL --exit-code 1 --quiet >/dev/null
echo "gate exit: $?"
Illustrative output (vulnerability DB of 17 November 2026; a later DB can list new HIGH or CRITICAL findings and print `gate exit: 1`)
gate exit: 0

04. Check your understanding

Practice check · 3 questions

Image SBOMs, scan gates and host-level CVEs

Three questions on the SBOM lab and on where a fix belongs.

Q1. Why does the lab generate the SBOM from the built image rather than from `go.mod` in the source tree?
Q2. A pipeline runs `trivy sbom sbom.cdx.json --severity HIGH,CRITICAL` and the job passes despite 13 findings. Why?
Q3. A scan of your Kubernetes platform flags CVE-2024-21626 ("Leaky Vessels"), a container escape in runc. Where does the fix belong?
Practice only: not graded, not saved, not evidence.

05. Apply it

Put these practices into your pipelines:

  • Automate SBOM Generation in CI: Integrate Syft into your build workflows (syft scan <image> -o cyclonedx-json=sbom.cdx.json) and publish the SBOM alongside the image it describes.
  • Adopt CycloneDX: Standardize on CycloneDX JSON (Syft 1.57 writes spec 1.7) for component inventories with package URLs (PURLs), and check that your scanners read the spec version you produce.
  • Integrate OpenVEX for Triage: Author version-controlled OpenVEX documents for specific non-exploitable vulnerabilities, each backed by evidence (such as govulncheck output) and a tracked review date in your ticket system.
  • Incorporate EPSS and CISA KEV: Configure triage policies to prioritize vulnerabilities actively exploited in the wild over high-CVSS theoretical flaws.
  • Scan Upstream Base Images: Audit base container images during CI builds to catch outdated operating system packages before shipping.
  • Establish Centralized SBOM Ingestion: Ingest SBOMs into dependency tracking platforms (such as Dependency-Track or Anchore Enterprise) for continuous fleet-wide monitoring.

06. Review prompt

Explain the fundamental architectural difference between an SBOM component inventory and a point-in-time vulnerability scan report. Describe how OpenVEX documents enable engineering teams to suppress non-affecting vulnerability alerts without compromising security posture, and explain why incorporating the Exploit Prediction Scoring System (EPSS) alongside CVSS provides superior vulnerability prioritization during sprint planning.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

6 questions · about 5 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check