A customer emails on Monday morning and asks whether your product ships a vulnerable version of Log4j. Nobody on the team knows offhand. With a software bill of materials (SBOM) you can answer in seconds: it lists every library in the project with its version, including the ones you never installed on purpose. This guide shows how to generate an SBOM with Syft 1.57.2 for a Node.js project and for container images, scan the SBOM file with Grype 0.122.1 for known vulnerabilities and sort the findings so you patch what attackers actually exploit first. I ran every command on December 2, 2026 on a Linux machine. You need no Docker daemon and no account.
What an SBOM is and why it is becoming mandatory
An SBOM is a machine-readable parts list. Each entry carries a name, a version, a license and an unambiguous identifier such as a package URL (pkg:npm/express@4.17.1). Two SBOM formats dominate: CycloneDX, an OWASP project with a security focus, and SPDX from the Linux Foundation, which grew out of license compliance. Syft writes both, so you do not have to decide before you start. Teams that care about software supply chain security usually generate SBOMs for every release, because the list only helps if it exists before the next advisory lands.
For anyone selling products with digital elements in the EU, the SBOM is no longer optional. The Cyber Resilience Act (CRA) requires manufacturers in Annex I, Part II, point 1 to document vulnerabilities and components, including an SBOM in a commonly used, machine-readable format that covers at least the top-level dependencies. That requirement applies from December 11, 2027. The law does not name a format. Germany’s BSI Technical Guideline TR-03183-2 asks for CycloneDX 1.6 or later, or SPDX 3.0.1 or later, with dependencies resolved recursively. This overview of the CRA’s SBOM requirements covers both. If you add SBOM generation to your build now, you will not have to retrofit it in a hurry later.
The practical payoff arrives sooner, though. When the backdoor in the LiteLLM packages on PyPI and Docker surfaced in October 2026, the first question in every team was whether they used it and in which version. With one SBOM per release, that is a search in an archive instead of a round of messages.
Install Syft and Grype without root
Syft generates the SBOM. Grype reads it and checks it against a vulnerability database. Both tools come from Anchore, are open source and ship as a single binary. Syft is a CLI tool and library that catalogs container images and filesystems. Grype is a vulnerability scanner for the same two targets. The install scripts put them in a directory of your choice:
mkdir -p ~/.local/bin
curl -sSfL https://get.anchore.io/syft | sh -s -- -b ~/.local/bin
curl -sSfL https://get.anchore.io/grype | sh -s -- -b ~/.local/bin
export PATH="$HOME/.local/bin:$PATH"
syft version
grype version
On my machine the commands reported Syft 1.57.2 (built November 16, 2026) and Grype 0.122.1 (built November 18, 2026). The Syft repository on GitHub and the Grype repository list other install options such as Homebrew and Docker.
Create a sample project with outdated dependencies
To give Grype something to find, we build a project with deliberately old versions of Express and lodash. A lockfile is enough. You do not need a node_modules folder:
mkdir demo && cd demo
cat > package.json <<'JSON'
{
"name": "sbom-demo",
"version": "1.0.0",
"private": true,
"dependencies": {
"express": "4.17.1",
"lodash": "4.17.20"
}
}
JSON
npm install --package-lock-only
cd ..
npm already prints vulnerability warnings here. That is fine. We want to see whether Grype finds the same issues and more.
Generate the SBOM with Syft
Syft scans directories, single files and container images. To generate an SBOM for the project, one command writes a CycloneDX SBOM as JSON:
syft scan dir:demo \
--source-name sbom-demo --source-version 1.0.0 \
-o cyclonedx-json=sbom.cdx.json
The two --source options are not required, but they are worth the typing. Without them Syft warns that it has no name or version for the directory and derives an ID from the path. With them, the header of the SBOM records which release it belongs to. The scan took less than a second and produced a CycloneDX 1.7 document with 52 libraries. One entry looks like this (shortened):
{
"type": "library",
"name": "express",
"version": "4.17.1",
"licenses": [{ "license": { "id": "MIT" } }],
"cpe": "cpe:2.3:a:openjsf:express:4.17.1:*:*:*:*:node.js:*:*",
"purl": "pkg:npm/express@4.17.1"
}
Syft read the packages from package-lock.json, including all transitive dependencies. The count is small only because the example is small. The purl is the key scanners use to match a component against vulnerability data. If you want SPDX instead of CycloneDX, name a second output format or convert the file you already have:
syft scan dir:demo --source-name sbom-demo --source-version 1.0.0 \
-o cyclonedx-json=sbom.cdx.json -o spdx-json=sbom.spdx.json
syft convert sbom.cdx.json -o spdx-json=sbom.spdx.json
Mind the versions: Syft writes SPDX 2.3, while CycloneDX comes out as 1.7. If you want to follow the BSI guideline, CycloneDX is the safer choice. If you only use npm, npm sbom --sbom-format cyclonedx is an alternative. With npm 11.21.1 it produced CycloneDX 1.5. Syft also understands Python, Java, Go, Rust, PHP and other ecosystems, so one command covers a mixed repository.
Scan container images without Docker
The same syntax works for images. With the registry: prefix, Syft pulls the image straight from the registry, so no local Docker daemon is needed:
syft scan registry:alpine:3.20 -o cyclonedx-json=alpine.cdx.json
For alpine:3.20 this returned 92 entries, which are operating system packages instead of Node modules. That layer is exactly what many SBOMs miss, and it matters for container security, even though OpenSSL, zlib and musl live there. An application in a container therefore deserves two scans: one of the project directory and one of the finished image.
Scan the SBOM for vulnerabilities with Grype
Grype takes the SBOM file as input. On the first run it downloads its vulnerability database, which took just under a minute for me. After that, scans are quick:
grype sbom:sbom.cdx.json
Example output from December 2, 2026 (first rows only, the database changes daily):
NAME INSTALLED FIXED IN TYPE VULNERABILITY SEVERITY EPSS RISK
lodash 4.17.20 4.17.21 npm GHSA-35jh-r3h4-6jhm High 20.6% (97th) 15.1
qs 6.7.0 6.7.3 npm GHSA-hrpp-h998-j3pp High 20.0% (97th) 15.0
lodash 4.17.20 4.17.21 npm GHSA-29mw-wpgm-hmr9 Medium 7.4% (94th) 3.8
lodash 4.17.20 4.18.0 npm GHSA-r5fr-rjxr-66jc High 3.1% (87th) 2.4
In total Grype reported 20 findings: 8 rated High, 6 Medium and 6 Low. Next to severity, the table has two columns older scanners lacked: EPSS and RISK. Grype sorts by RISK by default, a value from 0 to 100 that combines CVSS, EPSS and whether the issue is in the KEV catalog. If it is, Grype appends (kev) to the row. --sort-by lets you switch to severity, epss, kev, package or vulnerability. Anchore’s guide Understanding Grype results explains each column. With --by-cve, Grype shows CVE numbers instead of GHSA IDs, for example CVE-2021-23337 for the first lodash finding.
Grype is not a SAST tool. It does not read your own source code. It is a software composition analysis scanner and a vulnerability scanner for the dependencies and packages listed in the SBOM, so it will not find a SQL injection you wrote yourself.
Because Grype only reads the SBOM, you can scan the SBOM of a release from a year ago against today’s database without rebuilding the project. grype db status shows the state of the database, and grype db update fetches a newer one.
CVSS, EPSS and KEV: what to patch first
With 20 findings and a normal sprint, the question is the order. Three numbers help. The CVSS score from 0 to 10 describes how severe a flaw is if it gets exploited. EPSS from the FIRST forum estimates how likely it is that exploitation will be observed in the next 30 days, as a value between 0 and 1. And the KEV catalog from the US agency CISA lists vulnerabilities that are known to be under attack. CISA explicitly recommends using it as an input to your own prioritization. One sentence from the EPSS FAQ keeps expectations in check: EPSS is not a complete risk score, because it knows neither the damage a flaw could cause nor your environment. The number does not replace judgment. It sorts the queue.
Grype already folds these into one risk value. If you want to see the three numbers side by side, for instance to derive your own rules for ticket priorities, a small script helps. It reads Grype’s JSON output, fetches the KEV catalog from CISA and sorts by KEV, then EPSS, then CVSS. The EPSS values are already in Grype’s output, so no second lookup is needed. Because findings often carry a GHSA ID, the script matches the linked CVE numbers against the KEV catalog:
#!/usr/bin/env python3
"""Reads grype JSON and ranks findings by KEV, EPSS and CVSS."""
import json, sys, urllib.request
KEV_URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json"
def cve_ids(vuln, related):
ids = {vuln["id"], *(r["id"] for r in related)}
return {i for i in ids if i.startswith("CVE-")}
def best_cvss(vuln, related):
scores = [c["metrics"]["baseScore"]
for v in [vuln, *related] for c in v.get("cvss", [])]
return max(scores, default=0.0)
def main(path):
kev = {v["cveID"] for v in json.load(urllib.request.urlopen(KEV_URL))["vulnerabilities"]}
rows = []
for m in json.load(open(path))["matches"]:
v, rel = m["vulnerability"], m["relatedVulnerabilities"]
rows.append({
"pkg": f'{m["artifact"]["name"]}@{m["artifact"]["version"]}',
"id": v["id"],
"cvss": best_cvss(v, rel),
"epss": max((e["epss"] for e in v.get("epss", [])), default=0.0),
"kev": bool(cve_ids(v, rel) & kev),
"fix": ",".join(v["fix"]["versions"]) or "-",
})
rows.sort(key=lambda r: (r["kev"], r["epss"], r["cvss"]), reverse=True)
print(f'{"Package":<22}{"Finding":<22}{"CVSS":>5}{"EPSS":>8} KEV Fix')
for r in rows:
print(f'{r["pkg"]:<22}{r["id"]:<22}{r["cvss"]:>5.1f}{r["epss"]*100:>7.1f}% '
f'{"yes " if r["kev"] else "no "} {r["fix"]}')
main(sys.argv[1])
Save it as prioritize.py and feed it the JSON output:
grype sbom:sbom.cdx.json -o json -q > grype.json
python3 prioritize.py grype.json
The result for the sample project (excerpt, December 2, 2026):
Package Finding CVSS EPSS KEV Fix
lodash@4.17.20 GHSA-35jh-r3h4-6jhm 7.2 20.6% no 4.17.21
qs@6.7.0 GHSA-hrpp-h998-j3pp 7.5 20.0% no 6.7.3
lodash@4.17.20 GHSA-29mw-wpgm-hmr9 5.3 7.4% no 4.17.21
lodash@4.17.20 GHSA-r5fr-rjxr-66jc 9.8 3.1% no 4.18.0
lodash@4.17.20 GHSA-xxjr-mmjv-4gpg 8.2 1.8% no 4.17.23
The order shows why filtering by CVSS alone misleads. GHSA-r5fr-rjxr-66jc has the highest CVSS score at 9.8, yet EPSS gives it only 3.1 percent. The flaw in qs scores 7.5 but is a good six times more likely to be exploited, at 20.0 percent. Here both packages get upgraded anyway, so the order is academic. Prioritization starts to matter for findings you cannot fix right away.
I checked that the KEV match works with a counter-test: a directory with a pom.xml that pulls in log4j-core 2.14.1 produced two KEV hits with an EPSS of 100.0 percent at the top of the list, and Grype tagged them (kev). Nothing in the Express example is in the KEV catalog, so the column reads “no” throughout.
Use it as a gate in CI
The scan belongs in every build, in whatever CI pipelines you run. Grype exits with code 2 when a finding reaches the severity you choose, which fails the pipeline:
syft scan dir:. --source-name "$APP" --source-version "$VERSION" \
-o cyclonedx-json=sbom.cdx.json -q
grype sbom:sbom.cdx.json --only-fixed --fail-on high -q
I ran both variants against the sample project. --fail-on high ended with exit code 2. The combination --only-fixed --fail-on critical ended with 0 because nothing was rated critical. --only-fixed hides findings that have no corrected version yet, otherwise you block the build over something you cannot fix. Keep sbom.cdx.json as a build artifact. It is the inventory you will reach for when the next advisory lands. The commands work in any CI system, but I only tested them in a shell.
For known false positives, put a .grype.yaml in the working directory. Grype loads it from there automatically, and a test with one ignored finding cut the list from 20 to 19 entries:
ignore:
- vulnerability: GHSA-29mw-wpgm-hmr9
package:
name: lodash
Write down in version control why each entry is ignored. Otherwise nobody remembers in six months whether the exception still holds.
The check: upgrade and scan again
To close the loop, upgrade both packages, regenerate the SBOM and scan again:
cd demo
npm install express@latest lodash@latest --package-lock-only
cd ..
syft scan dir:demo --source-name sbom-demo --source-version 1.0.1 \
-o cyclonedx-json=sbom2.cdx.json -q
grype sbom:sbom2.cdx.json
On my machine npm installed Express 5.3.0 and lodash 4.18.1. The new SBOM had 68 components, and Grype printed No vulnerabilities found. Keep in mind that Express 5 is a major upgrade that can require code changes in a real application. In practice you jump only to the version Grype lists in the “FIXED IN” column and test afterwards.
Where to go from here
A few lines now give you SBOM generation, a vulnerability check and prioritization. If you manage many projects, feed the CycloneDX files into a central platform such as OWASP Dependency-Track for continuous monitoring. You can also look up a flaw without writing a script yourself: the tutorial Build an MCP server in Python creates a small server that lets an AI assistant query the EPSS score and KEV status of a CVE. And for a current example of how flaws creep into dependencies, read our piece on the cross-spawn vulnerability, a package that almost every Node.js project carries as a transitive dependency.




