Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
Know it before you install
Grype finds the packages (with Syft's catalogers, or from an SBOM you give it) and matches them against its vulnerability database (NVD, GitHub advisories, distro security data). Each match has a severity, a fix state (fixed, not-fixed, wont-fix) and the fixed version.
| Item | Value |
|---|---|
| Program | grype (one binary from Anchore) |
| Database | ~/.cache/grype/db/ (updated automatically, or grype db update) |
| Sources | IMAGE, registry:IMAGE, dir:PATH, sbom:FILE |
| Config | .grype.yaml in the project |
| Outputs | table, json, cyclonedx, sarif, template |
Install on RHEL and Ubuntu
First configuration: scan and set the gate
grype nginx:1.27
NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY
libssl3 3.0.15-1~deb12u1 3.0.16-1~deb12u1 deb CVE-2025-xxxx High
…
grype registry:harbor.example.com/shop/shop:1.4.0 --only-fixed --fail-on high
grype sbom:sbom.cdx.json -o sarif > grype.sarif
grype dir:. --fail-on criticalA config file for the project:
fail-on-severity: high
only-fixed: true
output: table
ignore:
- vulnerability: CVE-2024-12345
reason: "Not reachable: the vulnerable function is not used. Ticket SEC-142, review 2027-03-31."
- vulnerability: GHSA-xxxx-yyyy-zzzz
package:
name: example-lib
version: 1.2.3
- fix-state: wont-fix| Setting | Why |
|---|---|
fail-on-severity: high | Exit code 1 on high or critical — the CI job stops. |
only-fixed | Show only CVEs that have a fix (you can act on them now). |
ignore with a reason | Accepted risks are written down, with a ticket and a review date. |
fix-state: wont-fix | Hide issues the distro will never fix (decide this as a team). |
Daily use: the commands and the real uses
grype IMAGE -o json | jq '[.matches[] | .vulnerability.severity] | group_by(.) | map({(.[0]): length}) | add'
grype IMAGE --by-cve
grype explain --id CVE-2025-xxxx < report.json
grype IMAGE --vex openvex.json
grype db check
GRYPE_DB_AUTO_UPDATE=false grype sbom:sbom.cdx.json--vex reads a VEX document that says "this CVE does not affect our product" — the standard way to record not-affected decisions.
Real uses at work:
- CI gate after the image build (or on the SBOM from Syft).
- A nightly job that re-scans all stored SBOMs with the newest database and opens tickets for new high/critical CVEs.
- Compare base images: which one has fewer fixable CVEs?
Make it safe
Security checklist:
- Fresh database for every run (or daily); in air-gapped networks, mirror the DB and update it regularly.
- Every ignore has a reason, an owner and a review date; prefer VEX documents.
- Scan the image digest you ship; keep the reports with the release.
- Pin the Grype version in CI.
- A clean scan does not mean "safe": also use SAST (Semgrep), secrets scanning (Gitleaks), and runtime detection (Falco).
Update and remove
Run the install script again (or the new package), then grype db update. Remove: rm /usr/local/bin/grype and rm -rf ~/.cache/grype.
Fix common problems
| Problem | Cause | Fix |
|---|---|---|
failed to load vulnerability db / download error | No internet or proxy issues. | Set HTTPS_PROXY; grype db update; offline: import a DB archive (grype db import). |
db is too old warning | The database was not updated. | grype db update, or turn on auto update. |
| Too many findings | All severities, unfixed CVEs, old base image. | --only-fixed, --fail-on high; update the base image first (biggest win). |
| A false positive | Wrong package match (CPE) or not affected. | Add an ignore rule with a reason, or a VEX statement. |
| Private image can not be pulled | No registry login. | docker login, or GRYPE_REGISTRY_AUTH_* variables; registry: source. |
| Results differ from Trivy | Different data sources and matching. | Normal; pick one tool as the gate per pipeline. |
Next steps
- Quick how-tos: Create and scan an SBOM, Find vulnerable dependencies.
- Command page: grype.
- Learn it for the CKS: Scan images. At work: Grype — CVEs from images and SBOMs.
- Make the SBOM: Syft. The all-in-one scanner: Trivy.
1What does --only-fixed change?
Grype shows only vulnerabilities that already have a fixed version.
2How do you document that a CVE does not affect your product?
An ignore rule with a reason and review date, or better a VEX document passed with --vex.