Contents
Trivy checks the container images and source code you use for known vulnerabilities and for secrets such as API keys. It scans files on your own machine, so it is an easy first tool to try.
This review is for people who build software with dependencies from Docker, npm, or similar ecosystems. After reading it, you can do the following:
- List the vulnerable dependencies in a project on your computer
- Filter the results by severity and start with the ones that have a fix
- Scan a container image
What Trivy is for
You use Trivy by combining a target (where to look) with scanners (what to look for).
| Targets | Scanners |
|---|---|
| Container images | OS packages and dependencies (SBOM) |
| Filesystem (a local folder) | Known vulnerabilities (CVEs) |
| Git repositories (remote) | IaC issues and misconfigurations |
| Virtual machine images | Secrets such as API keys |
| Kubernetes | Software licenses |
The two columns don’t map one to one. For example, you can look for vulnerabilities, secrets, and misconfigurations in a local folder in a single run.
Install
The official installation page lists every method. The common ones are:
- macOS and Linux:
brew install trivywith Homebrew - Debian, Ubuntu, RHEL, and CentOS: add the official package repository and install from it
- Windows: download
trivy_<version>_windows-64bit.zipfrom the releases page and unzip it - Docker: use the official
aquasec/trivyimage
After installing, run trivy --version to check that it prints a version number.
Try it safely: scan a local project
-
Go to the folder of the project you want to check.
-
Run this command to look for vulnerabilities, secrets, and misconfigurations together:
trivy fs --scanners vuln,secret,misconfig . -
The first run downloads the vulnerability database, so it takes a little longer. When it finishes, Trivy prints the problems it found as a table.
Most of the traffic Trivy sends out is the download of this database and of the misconfiguration checks, both from mirror.gcr.io or ghcr.io. Later runs use the local cache, and --skip-db-update skips the database update. Trivy can also call APIs to identify dependencies; --offline-scan turns that off.
Filter the results
The first results are often long. Use these options to focus on what to fix now.
| Option | What it does |
|---|---|
--severity HIGH,CRITICAL |
Show only HIGH and CRITICAL findings |
--ignore-unfixed |
Show only vulnerabilities that have a fixed version |
--exit-code 1 |
Exit with code 1 when anything is found, to fail a CI job |
-f json -o results.json |
Save the results to a JSON file |
To scan a container image, use trivy image <image>. For example, trivy image --severity HIGH,CRITICAL python:3.4-alpine shows only the serious vulnerabilities in an old Python image.
Cautions
- In March 2026, Trivy’s own release artifacts were tampered with. Using stolen credentials, an attacker published a malicious v0.69.4 release, malicious tags for the
trivy-actionandsetup-trivyGitHub Actions, and malicious v0.69.5 and v0.69.6 images on Docker Hub. Each was removed within a few hours to about half a day. If any CI job or computer used them during that window, check the official advisory (GHSA-69fq-xp46-6x23) and rotate every secret that environment could reach. Going forward, pin versions and reference images by digest so that a replaced release is less likely to reach you. - Don’t panic over the number of findings. Whether a fix is urgent depends on whether you actually use the affected code and whether it is reachable from outside.
- Deleting a leaked key from the repository is not enough, because it stays in the Git history. Revoke the key and issue a new one.
Read next
Sources
- Official repository (README)github.com/aquasecurity/trivy
- Docs: Installationtrivy.dev/docs/latest/getting-started/installation/
- Docs: Filteringtrivy.dev/docs/latest/guide/configuration/filtering/
- Docs: Databasestrivy.dev/docs/latest/guide/configuration/db/
- Docs: trivy filesystem optionstrivy.dev/docs/latest/guide/references/configuration/cli/trivy_filesystem/
- Security advisory GHSA-69fq-xp46-6x23 (March 2026 supply chain compromise)github.com/advisories/GHSA-69fq-xp46-6x23
Checked on 2026-10-25
Similar tools
Gitleaks
Impact Local onlyA command-line tool that finds passwords, API keys, and tokens that have slipped into Git repositories and files.
- Purpose
- Defense
- Type
- Command line
- Difficulty
- Beginner
- License
- PermissiveMIT
- Category
- Vulnerability scanning
OSV-Scanner
Impact Local onlyA command-line tool from Google that reads your project's dependencies and checks them against the OSV.dev vulnerability database.
- Purpose
- Defense
- Type
- Command line
- Difficulty
- Beginner
- License
- PermissiveApache-2.0
- Category
- Vulnerability scanning
Prowler
Impact Reaches othersAn audit tool that reads the configuration of AWS, Azure, Google Cloud, and other clouds and lists the settings that fail security standards.
- Purpose
- Audit
- Type
- Command line
- Difficulty
- Intermediate
- License
- PermissiveApache-2.0
- Category
- Containers and cloud