Guides / Basics

What is an SBOM? CycloneDX, SPDX and package URLs in practice

beginnerUpdated 26 Nov 2026746 words

When Log4Shell was published, the first question everywhere was "do we run log4j-core, and where?". Teams with a list of the components in each application answered it in minutes. That list is a software bill of materials (SBOM). Trivy writes one for a server or a container image in either of the two common formats, and scans it again later without the image.

What an SBOM contains

An SBOM is a machine-readable list of the components in a piece of software: name, version, a unique identifier, and often the supplier, licence and hashes. For a container image it lists the operating system packages and the language packages inside. For a server it lists the installed packages.

An SBOM is an inventory, not a vulnerability report. Vulnerabilities are matched against it later, and the same SBOM can be matched again every day as new CVEs come out, without access to the image or the server.

The two formats

CycloneDX SPDX
Maintained by OWASP Linux Foundation
Standard Ecma ECMA-424 ISO/IEC 5962:2021
Current version 1.7 is what Trivy 0.75.0 writes 3.0 is current; Trivy writes 2.3
Focus security: components, services, vulnerabilities, VEX licences and provenance, with security added
File JSON or XML JSON, tag-value, RDF and others

Both work for vulnerability matching. Pick the one your tools read; most scanners read both. CycloneDX can also carry vulnerabilities and VEX statements in the same document.

Package URLs (purl)

Each component needs an identifier that tools can match without guessing. Both formats use the package URL, pkg:type/namespace/name@version?qualifiers:

pkg:deb/debian/libssl3@3.0.15-1~deb12u1?arch=amd64&distro=debian-12.9
pkg:pypi/pip@24.3.1
pkg:maven/org.apache.logging.log4j/log4j-core@2.14.1
pkg:golang/golang.org/x/net@v0.17.0

The type says which ecosystem and therefore which version rules apply. The distro qualifier on the Debian package tells a scanner to use Debian 12 data, which is what makes backported fixes come out right.

Make an SBOM with Trivy

# a container image
trivy image --format cyclonedx --output app.cdx.json registry.example.com/app:1.4
# the running host (operating system packages and language packages it finds)
sudo trivy rootfs --format cyclonedx --output host.cdx.json /
# an application directory with lockfiles
trivy fs --format cyclonedx --output app-src.cdx.json /srv/app
# SPDX instead of CycloneDX
trivy image --format spdx-json --output app.spdx.json registry.example.com/app:1.4

For python:3.12.8-slim, the CycloneDX file lists 107 components and is about 200 KB. A component looks like this (shortened):

{
  "type": "library",
  "name": "libssl3",
  "version": "3.0.15-1~deb12u1",
  "purl": "pkg:deb/debian/libssl3@3.0.15-1~deb12u1?arch=amd64&distro=debian-12.9",
  "properties": [
    { "name": "aquasecurity:trivy:SrcName", "value": "openssl" },
    { "name": "aquasecurity:trivy:SrcVersion", "value": "3.0.15" }
  ]
}

The SrcName property records the Debian source package. Debian publishes fixes per source package, so the scanner needs it to match libssl3 against advisories for openssl.

Docker can also attach an SBOM to an image at build time (docker buildx build --sbom=true), stored next to the image in the registry.

Scan an SBOM

trivy sbom app.cdx.json
trivy sbom --severity CRITICAL --ignore-unfixed app.cdx.json

Scanning the SBOM of python:3.12.8-slim gave the same 9 critical findings as scanning the image itself. This is the main practical use: generate the SBOM once per build, keep it with the release, and match it again whenever the vulnerability data changes.

What an SBOM does not tell you

  • Whether a component is used. A library in the list may never be loaded. VEX documents can state "not affected" for specific CVEs.
  • Anything the generator could not see. Software compiled from source without package metadata is missing. In the python:3.12.8-slim SBOM, the Python interpreter itself, built into /usr/local, is not listed.
  • Whether the list is still current. An SBOM describes one build. A server changes with every update; make a new one after each change, or on a schedule.

Where SBOMs are going

Regulation is making SBOMs common in software that is sold: the EU Cyber Resilience Act requires manufacturers of products with digital elements to document their components, including in an SBOM. For a small team, the immediate benefit is simpler: one command answers "where do we run version X of Y?".

Sources

Check your servers every day

The agent of Patchbrief reports the packages and settings of a server once a day; the digest names what to fix first.

Start free